Monday, 11 June 2012

IsMobileDevice returns false for iPhone using .NET 3.5

When using .NET 3.5 or earlier you find that you can detect a mobile browser using the following property. However when using new devices such as iPhones the value always returns false.

HttpContext.Current.Request.Browser.IsMobileDevice

This is because this version of the .NET framework is not aware of new devices such as iPhones

For this property to be correctly detected you need to download the browser definition files from CodePlex and place them in the app_browsers directory

The IsMobileDevice should now return the correct value.






No comments:

Post a Comment