MVC4: disable mobile views on some controllers

I have .cshtml and .Mobile.cshtml for all of my views. Is there a way to disable .Mobile.cshtml on some controllers? For such controllers, I always want to use regular views instead of mobile views.

Thank!!

+5
source share
1 answer

Sorry for the stupidity. But if you always want to use the normal view, just delete the mobile view from the project.

Edit

To make the browser load the desktop view on the mobile device, you will need to use the BrowserHelper SetOverriddenBrowser

In your action method, you can do something like this

HttpContext.SetOverriddenBrowser(BrowserOverride.Desktop);

http://blog.mirajavora.com/overriding-browser-capabilities-in-asp.net

+3

All Articles