views:

804

answers:

4

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.

+2  A: 

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.

Nick Berardi
+1  A: 

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.

Pat
+1  A: 

Hi, 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.

fravelgue
A: 

Hello

You can look at http://51degrees.codeplex.com it is free open source asp.net mobile api which helps is tracking whether request is coming from mobile devices and redirects user to mobile optimized .aspx pages without changing any existing web pages. It makes use of WURFL the most upto date mobile device database. Along with this it also gives you detailed capability information of mobile device making request which you can use to customize pages for each mobile device.

With this you can have same web address for both current and mobile websites.

Amit Patel