Steve asked me in a previous post for a sample application for detecting a mobile device and rendering a mobile view in ASP.NET MVC.

You can download a sample MVC app here.

The app is the same as the ASP.NET MVC template that the "GU" put together, with the added mobile action filter and views.

image

I've also updated my mobile browser detection. Turns out not to be so straight forward as new phones are coming out all the time with different User Agents etc. This is the best "generic" way I could find:

if (filterContext.HttpContext.Request.Browser.IsMobileDevice || 
	filterContext.HttpContext.Request.ServerVariables["HTTP_ACCEPT"].Contains("text/vnd.wap.wml") ||
	filterContext.HttpContext.Request.ServerVariables["HTTP_ACCEPT"].Contains("application/vnd.wap.xhtml+xml")
)
			

Hope this help Steve, let me know how you get on.

Technorati Tags: ,