Request.ServerVariables question

  • Thread starter Thread starter Scott M.
  • Start date Start date
Also, you only need to type:

Request.ServerVariables["HTTP_USER_AGENT"]

not

System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]

if you are using VS.NET.
 
I'm using this to get what browser with which the user is browsing.
System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]


How come when I browse with Netscape 4.7, I get this:
Mozilla/4.72 [en] (Windows NT 5.0; U)

It doesn't tell me that it's netscape, only the version number. Is there
something I need to configure to get this to work correctly?

Andrea
 
Actually I need the whole thing, b/c the code is not in a web project, but
in a separate assembly.

However, my pages inherit the code so that I can have common error handling
and User Tracking on my pages.

I did find the solution to my problem:
gstrBrowser = System.Web.HttpContext.Current.Request.Browser.Browser;

That gives me the Browser name, should anyone else need it.

Andrea


Scott M. said:
Also, you only need to type:

Request.ServerVariables["HTTP_USER_AGENT"]

not

System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]

if you are using VS.NET.


Andrea Williams said:
I'm using this to get what browser with which the user is browsing.
System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]


How come when I browse with Netscape 4.7, I get this:
Mozilla/4.72 [en] (Windows NT 5.0; U)

It doesn't tell me that it's netscape, only the version number. Is there
something I need to configure to get this to work correctly?

Andrea
 
Back
Top