Write For Us

Visitor Informations From Request.ServerVariables Collection

The ServerVariables collection retrieves the values of predetermined environment variables and request header information. If you've ever wondered how to get your website visitor's name, or their IP address, or the referrer address, then look no more. Request.ServerVariables is almost all you need.


Be warned that Server variables obtain most of their information from headers. It is not wise to depend a 100% on the data that is returned contained in the collection, as this information can be falsified by malicious users, like hackers, etc.

To get a value from the ServerVariables collection, all you have to do is use the Request object and access the item in the ServerVariable collection using the header name.


Note: The server interprets any underscore (_) characters in HeaderName as dashes in the actual header. For example if you specify LOGON_USER, the server searches for a header sent as LOGON-USER.

Some useful variables are as follows:


The Windows NT account that the user is logged into.


The IP address of the remote host making the request - This is the IP address of the user.


The name of the host making the request - This is also the Remote Name associated with the user.


The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on.


Returns a string containing the URL of the page that referred the request to the current page, but does not include redirect requests

Furthermore, we can get Browser information using the HttpBrowserCapabilities class found in System.Web namespace in .NET Framework.

To do so, you have to create an object of type System.Web.HttpBrowserCapabilities.

Dim myBrowser As Web.HttpBrowserCapabilities
myBrowser = Request.Browser

Having done that, the following information can be retrieved:

Platform: myBrowser.Platform
This will return the Platform the user is using, i.e. the Operating System.

Browser Language: Request.ServerVariables["http_accept_language"]
This returns the Language.

Browser type: myBrowser.Type
This returns the Browser information. I.e. Internet Explorer, Firefox, etc.

Browser version: myBrowser.Version
This returns the version of the current browser.

Browser Beta: myBrowser.Beta
Checks to see if the user is using a Beta version of the browser.

Client CLR Version: myBrowser.ClrVersion
Gets the CLR version.

Supports ActiveX controls: myBrowser.ActiveXControls
Checks to see if the browser supports ActiveX components or not.

Supports Cookies: myBrowser.Cookies
Checks to see if the browser supports Cookies or not.

Supports Frames: myBrowser.Frames
Checks to see if the browser supports Frames.

Supports Java Applets: myBrowser.JavaApplets
Checks support for Java Applets.

Supports Java Scripts: myBrowser.JavaScript
Checks support for JavaScripts.

Supports MS DOM Version: myBrowser.MSDomVersion
Checks the System's DOM version.

Tutorial toolbar:  Tell A Friend  |  Add to favorites  |  Feedback  |