Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC4: Disable mobile views on certain controllers

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

Thanks!!

like image 925
eadam Avatar asked Oct 22 '22 16:10

eadam


1 Answers

Sorry for sounding stupid. But if you always want to use a normal view, just remove the mobile view from the project.

Edit

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

Within your action method you could do something like this

HttpContext.SetOverriddenBrowser(BrowserOverride.Desktop);

Try this link for more help http://blog.mirajavora.com/overriding-browser-capabilities-in-asp.net

like image 192
Colin Bacon Avatar answered Oct 27 '22 19:10

Colin Bacon