when I use the mobile visit my site,but MVC cannot show the mobile view.Why
http://www.hanselman.com/blog/MakingASwitchableDesktopAndMobileSiteWithASPNETMVC4AndJQueryMobile.aspx
firelamb
MVC cannot show the mobile view
Have you suffixed your view for mobile devices?
Can you check you are getting proper user agent?
Hi firelamb,
Thanks for your post.
I also think you can check if you are getting proper useragent,like this:
string strUserAgent = Request.UserAgent.ToString().ToLower(); if (strUserAgent != null) { if (Request.Browser.IsMobileDevice == true || strUserAgent.Contains("iphone") || strUserAgent.Contains("mobile") || strUserAgent.Contains("windows ce")) { //do something } }
More information:
#Mobile Device Detection and Redirection Using ASP.NET/MVC
#Creating Mobile-Optimized Views in ASP.NET MVC 4
http://msdn.microsoft.com/en-us/magazine/dn296507.aspx
Best Regards,
Eileen