Search code examples
c#asp.netiphonebrowsermobile-browser

How to know if the asp.net site is accessed from a mobile device or from a system/laptop/machine(windows,mac etc)


I have developed a website using asp.net web developer 2010. I would like to redirect to different page if the site is accessed from mobile browser. And, different functionality for windows/mac/linux etc users.

How can I do this?

I referred some posts in some forums, and it is said that I need to depend on third party libraries.

How could I implement this without any third party libraries?

Any one Please help me out.

Any help is appreciated. Thanks!!


Solution

  • The Request.Browser object properties are probably where it is at, these are all options that may be useful to you:

    Request.Browser.IsMobileDevice
    Request.Browser.MobileDeviceManufacturer
    Request.Browser.MobileDeviceModel
    Request.Browser.ScreenPixelsWidth
    Request.Browser.SupportsXmlHttp
    

    Was there a reason you wanted to avoid a 3rd party component?

    We currently use a WURFL device database via 51Degrees.mobi - which works really well.