How does IsMobileDevice work?

Viewed 43243

MSDN makes it sound so easy to detect a mobile browser:

if (Request.Browser["IsMobileDevice"] == "true" ) 
{
    Response.Redirect("MobileDefault.aspx");
}

Actually, it looks like you can also just check Request.Browser.IsMobileDevice. But how does this actually work? I don't even have a .browser file... what's going on behind the scenes here? Are there some built-in defaults for ASP.NET 2.0?

7 Answers

Simply use below code,

if (Request.Browser.IsMobileDevice) 
{
    Response.Redirect("MobileDefault.aspx");
}
Related