I know I can use Request.Browser.IsMobileDevice.
But does anyone know how it works, and if it is reliable and up to date?
Thanks!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You need to regularly update BrowserCaps to keep it up-to-date.
http://www.asp.net/mobile/device-updates/instructions/
Note: (Aug 25 2012) apparently the page has been removed.
Method 2
And if you need some more advance and mature, then try WURFL.
Method 3
You are looking for this. Put it in a folder in the App_Browsers folder. http://mdbf.codeplex.com/
Method 4
If you’re going to use the latest and greatest features available you should take a look into the IE9 demo for Media Queries to make your decision by checking the current screen resolution.
Method 5
This question needed some 2018 love. Try this.
if(Request.Browser.IsMobileDevice){
// do something
}
You shouldn’t need any @using statements for this, but if you did Intellisense would you tell and help you add it with a click.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0