HLRosenberger
asked on
determining client browser in codebehind
I'm trying to determine the client browser being used, via code on the server. Is this possible? I tried these objects: Page.Request.UserAgent and Page.Request.Browser.Brows er. I've read that this is the way to do it. However, what I see does not make sense to me.
If the browser is Firefox, Page.Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"; Page.Request.Browser.Brows er = "Firefox".
If the browser is IE, Page.Request.UserAgent = ""Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"" Page.Request.Browser.Brows er = "Mozilla".
How can this be? What is the correct way to determine the browser?
If the browser is Firefox, Page.Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"; Page.Request.Browser.Brows
If the browser is IE, Page.Request.UserAgent = ""Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"" Page.Request.Browser.Brows
How can this be? What is the correct way to determine the browser?
ASKER
paulmacd: I've already seen these articles. What I need to know is why, when I'm using IE, does it tell me Mozilla?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It has always said 'Mozilla'. Here is a list of the thousands of User Agent Strings that have existed for different browsers. http://www.useragentstring.com/pages/useragentstring.php
ASKER
thanks
How to: Detect Browser Types and Browser Capabilities in ASP.NET Web Pages:
http://msdn.microsoft.com/library/3yekbd5b
How to determine browser type in server-side code without the BrowserType object in ASP.NET:
http://support.microsoft.com/kb/306576
How to: Detect Browser Types in ASP.NET Web Pages:
http://msdn.microsoft.com/en-us/library/3yekbd5b(v=vs.90).aspx