Mobile device discovery MVC 4 Not viewable as for layout

I have a very strange problem. The worst part is that it ONLY happens in production (light blue), and not in a dev-machine.

I see that my application uses the .Mobile version of the layout, but it uses the desktop version (not .mobile). I completely lost the way I would even solve it.

He discovers a mobile version, but that’s not ... Any ideas?

+4
source share
2 answers

The engine uses the files located here - C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Browsers

(Or \Framework64\ )

They are probably different on any machine. Use Request.Browser.IsMobileDevice to find out which devices detect what. Can creating custom display modes also help?

http://weblogs.asp.net/gunnarpeipman/archive/2011/09/18/asp-net-mvc-4-display-modes.aspx

0
source

I thought the solution I gave below was the answer (it didn’t work for long), but after a while it still switched to the wrong look.

Like the rest of the Internet, I installed 51 Degrees from Nuget. This works fine and it is very easy to configure.


(The following does not work for me, but maybe this is for you) http://www.nuget.org/packages/Microsoft.AspNet.Mvc.FixedDisplayModes

This seems to be a known bug: http://aspnetwebstack.codeplex.com/workitem/280?PendingVoteId=280

According to the codeplex link above, be sure to verify this:

For a small set of projects that set up a list of registered views (for example, in Global.asax), you must make sure that you refer to Microsoft.Web.Mvc.FixedRazorViewEngine or Microsoft.Web.Mvc.FixedWebFormViewEngine, and not the classes that ship to binary binary binary

0
source

All Articles