Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile device is detected as non mobile device

I've included a mobile web form in my asp.net project, I thought that it could/should be seen just for my mobile users but I realize that it can also be seen from any browser, I don't see problem there cause I could diff the access using HttpBrowserCapabilities.IsMobileDevice=true and transferring to the appropiate aspx page, but it results that when I access to the web form from my mobile device it is identified as IsMobileDevice = false and sends me to another page.

How could it be possible that?

The mobile device runs Pocket PC 2003.

like image 220
Nelson Miranda Avatar asked Aug 16 '08 16:08

Nelson Miranda


People also ask

What is a non mobile device?

Nonmobile devices have no resource limitation and they are not easily portable, so an attacker can have the session connection during some hours, with not even the victim being aware of the attack.

How can you tell if someone is using your mobile device?

To detect if the user is using a mobile device in JavaScript, we can use the userAgent property. This property is part of the navigator object and sent by the browser in HTTP headers. It contains information about the name, version, and platform of the browser.


3 Answers

IMHO: The value of HttpContext.Current.Request.Headers("User-Agent") is a much safer bet as it actually indicates the browser that is making the request, and not the type of device per-se.

I've learnt from experience that if a smart phone makes a request through a third-party browser to your service, more-often-than-not any sort of "what type of device are you" test (HttpCapabilitiesBase.IsMobileDevice and/or HttpContext.Current.Request.Browser.IsMobileDevice) will fail.

Unfortunately though, short of a big list of allowed user-agents (or disallowed user-agents for that matter), you'll just have to make sure it doesn't start with Mozilla, iPhone or Opera before you render the page...

It's a hard arena to play in.
Good luck.

like image 140
Pat Hermens Avatar answered Sep 26 '22 15:09

Pat Hermens


Some are not recognized, because the UserAgent has been messed with or a new browser is being used. Such as Opera Mobile 9.5. To fix this you need to create a Browser (*.browser) file specifically for defining this. I had to do it for the new Mozilla based UserAgent that is being sent from Google.

like image 43
Nick Berardi Avatar answered Sep 22 '22 15:09

Nick Berardi


I think you should use other DDR better than Microsoft Browser Capabilities. I´m using http://wurfl.sourceforge.net>WURFL, it is open source and maybe it is more extended and updated. There is other commercial DDRs like DeviceAtlas.

There is many some .net libraries but i´m using Marg.Wurfl. It allows to rendering web mobile page using wurfl capabilities.

like image 41
fravelgue Avatar answered Sep 24 '22 15:09

fravelgue