Montag, 23. Juli 2012 14:52
I finally was able to get a MVC4 web role app deployed... granted it was just the startup app.... had to fix connection string and mark referenced assemblies to Copy Local = True... but then it deployed successfully... YAY!!!
But now... I'm just making a simple Mobile layout... adding _Layout.Mobile.cshtml... and changing some text to show that it's a mobile view for testing purposes.... IT DOES NOT WORK....
When viewing on Desktop... desktop view shows correctly as usual... but when viewing on mobile device... Android and iPad were used... it display Desktop version still and NOT mobile view...??
Website is http://sky-test.cloudapp.net
Copyright at bottom of screen should say "My Mobile MVC Application", not "My ASP.NET MVC Application" on mobile devices...?
Dienstag, 24. Juli 2012 03:40Moderator
I suggest you download samples with MVC mobile application with Nuget:
Or you can got more info from this blog:
Hope this helps.
Dienstag, 24. Juli 2012 12:53
That's a great suggestion and I'll go ahead and look at those links...
We moved a "working" MVC4 implementation with Mobile Views from GoDaddy Cloud VM's to Azure VM's and it stopped working once on the Azure VM's.... thus we obviously thought the problem was with Auzre VM's fyi.....
Dienstag, 24. Juli 2012 13:12Nope... looked at blog and as i thought... it's pretty hard to screw up Mobile views... says right on the blog it should work right out of the box.... created a _Layout.Mobile.cshtml file (right alongside the _Layout.cshtml file).... works in debug and on development... but doesn't work once deployed to cloud web role... In development I'm changing user agent of browser to see Mobile views render as expected... Why wouldn't this be working on the Cloud Web Role?
Montag, 30. Juli 2012 13:27
Turns out for every mobile device OTHER than iPhone, you must explicitly add it to navigate to the mobile view in the global.asax on Windows Azure web roles and vm's.... see code snippet below:
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
ContextCondition = (ctx => ctx.Request.UserAgent != null
&& (ctx.Request.UserAgent.IndexOf("Android", StringComparison.OrdinalIgnoreCase) >= 0
|| ctx.Request.UserAgent.IndexOf("Mobile", StringComparison.OrdinalIgnoreCase) >= 0
|| ctx.Request.UserAgent.IndexOf("Opera Mobi", StringComparison.OrdinalIgnoreCase) >= 0
|| ctx.Request.UserAgent.IndexOf("Opera Mini", StringComparison.OrdinalIgnoreCase) >= 0))
- Als Antwort markiert zenopm Montag, 30. Juli 2012 13:27