Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do mobile views in ASP.NET MVC display differently on different servers?
    text
    copied!<p>I am using the new ASP.NET MVC 4 beta and am trying to create a system that mostly works with responsive design, but for one specific view I am using a mobile view to render a specific view for mobile devices.</p> <p>My structure is simply that I have a Show.cshtml and following that I have a Show.mobile.cshtml.</p> <p>If I make my site available from my dev machine through IIS Express this view displays correctly for iPad, iPhone, Android phones and mobile Opera, and it also works the same if I make a local publish to IIS 7.5 on my dev machine.</p> <p>The problem comes when we deploy to a live server, we have tried deploying on two different servers. Then the mobile view will only be served to iPhones, no other mobile devices. This is consistently so. Our servers set up have been both Windows 2003/IIS6 and Windows 2008 R2/IIS7.5 and it works the same on both, only iPhone gets served the mobile view.</p> <p>What might be the cause of this?</p> <p>I have not added anything custom in global.asax for this.</p> <p><strong>UPDATE</strong></p> <p>After some more research it seems clear to me that the default behavior for DisplayMode and mobile views depends on the Request.Browser.IsMobileDevice flag. This flag in turn seems to rely on the .browser files that are in the Config/Browsers-folder of the .NET Framework folder.</p> <p>On my dev machine I have different .browser files than those that are present on the servers I have deployed to. So far I have tried to deploy the ones I have on my machine in the App_Browsers-folder of the web app, but that did not fix my issue. Might this be the way to go?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload