≡ Menu




How to access detailed information of a visitor in asp.net

In ASP.NET, the Request.ServerVariables collection holds a lot of useful information about the visitor.

For example:

// Getting ip of visitor
string ip = Request.ServerVariables[“REMOTE_ADDR”];
// Getting the page which called the script
string page = Request.ServerVariables[“HTTP_REFERER”];
// Getting Browser Name of Visitor
if (Request.ServerVariables[“HTTP_USER_AGENT”].Contains(“MSIE”))
  browser = “Internet Explorer”;
if (Request.ServerVariables[“HTTP_USER_AGENT”].Contains(“FireFox”))
  browser = “Fire Fox”;
if (Request.ServerVariables[“HTTP_USER_AGENT”].Contains(“Opera”))
  browser = “Opera”;

{ 0 comments… add one }

Leave a Comment