Get client browser details in asp.net

Description:-

Here is one more example to read client browser detail using HttpContext.Current.Request.Browser. Here I have read Client browser detail through code and display information on webpage to see which client come from which browser or else we can store client browser information in our database to keep in touch that’s coming more than one time. Here is the demo example to read browser detail in dot net.

Default.aspx.cs:-

protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
  {
    Response.Write(GetBrowserDetails());
  }
}

public static string GetBrowserDetails()
{
  string browserDetails = string.Empty;
  System.Web.HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;
  browserDetails =
    "Name = " + browser.Browser + ",<br/>"
    + "Type = " + browser.Type + ",<br/>"
    + "Version = " + browser.Version + ",<br/>"
    + "Major Version = " + browser.MajorVersion + ",<br/>"
    + "Minor Version = " + browser.MinorVersion + ",<br/>"
    + "Platform = " + browser.Platform + ",<br/>"
    + "Is Beta = " + browser.Beta + ",<br/>"
    + "Is Crawler = " + browser.Crawler + ",<br/>"
    + "Is AOL = " + browser.AOL + ",<br/>"
    + "Is Win16 = " + browser.Win16 + ",<br/>"
    + "Is Win32 = " + browser.Win32 + ",<br/>"
    + "Supports Frames = " + browser.Frames + ",<br/>"
    + "Supports Tables = " + browser.Tables + ",<br/>"
    + "Supports Cookies = " + browser.Cookies + ",<br/>"
    + "Supports VBScript = " + browser.VBScript + ",<br/>"
    + "Supports JavaScript = " + "," + browser.EcmaScriptVersion.ToString() + ",<br/>"
    + "Supports Java Applets = " + browser.JavaApplets + ",<br/>"
    + "Supports ActiveX Controls = " + browser.ActiveXControls + ",<br/>"
    + "Supports JavaScript Version = " + browser["JavaScriptVersion"];
  return browserDetails;
}

Related Posts

Previous
Next Post »

Thanks for comments.....