amateur
amateur

Reputation: 44605

inconsistent browser type value from request object

I am writing a C# application in which I need to retrieve the users browser type.

I get the above from the Request object, specifically from: Request.Browser.Type which a member of System.Web.HttpBrowserCapabilitiesBase.

The result I get from this is not consistent. Most of the time it is correct returning the users browser, eg IE7 etc but the odd time it returns the value "Desktop". I don't understand why this is being returned as obviously it is not correct as the user is visiting the web site via a web browser.

Anyone know why this is being returned and how I might "fix" it or use another way of consistently getting the users browser type?

Upvotes: 2

Views: 1024

Answers (1)

Adnan Bhatti
Adnan Bhatti

Reputation: 3480

ASP.Net does not have Chrome info in its database so therefore it cannot detect it automatically except saying Desktop ... which really indicate it is desktop computer browser not a mobile browser. You can mess around with Request.browser.browsers and so on and the best you will get is AppleSafari

However there are alternatives that exist since long and works for many.

Here is the link for alternative which should give you capability to detect chrome.

http://weblogs.asp.net/ricardoperes/archive/2009/09/22/detecting-chrome-browser-in-asp-net.aspx

Upvotes: 1

Related Questions