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.Browser.  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.Browser = "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.Browser = "Mozilla".

How can this be?  What is the correct way to determine the browser?
Who is Participating?
Paul MacDonaldDirector, Information SystemsCommented:
Oh, I see.  IE started identifying itself as Mozilla way back in the day so those websites "optimized for Mozilla" would see IE as Mozilla.

Paul MacDonaldDirector, Information SystemsCommented:
Here are several bits of sample code.  You may have to tease apart the Agent string to find exactly what you need.

How to: Detect Browser Types and Browser Capabilities in ASP.NET Web Pages:

How to determine browser type in server-side code without the BrowserType object in ASP.NET:

How to: Detect Browser Types in ASP.NET Web Pages:
HLRosenbergerAuthor Commented:
paulmacd:   I've already seen these articles.   What I need to know is why, when I'm using IE, does it tell me Mozilla?
Dave BaldwinFixer of ProblemsCommented:
It has always said 'Mozilla'.  Here is a list of the thousands of User Agent Strings that have existed for different browsers.
HLRosenbergerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.