Get Client Browser Details using C#

The C# provides the class "HttpBrowserCapabilities" which enables server to gather the information on the capabilities of the browser that is running on the client. The HTTP browser capabilities is derived from the class"HttpCapabilitiesBase" which has the properties that give the information about client browser. When the object is created for "HttpBrowserCapabilities using "HttpContext.Current.Request.Browser", the object will have all the browser details.

Code

  1. public static string GetBrowserDetails()  
  2. {  
  3.    string browserDetails = string.Empty;  
  4.    System.Web.HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;  
  5.    browserDetails =  
  6.    "Name = " + browser.Browser + "," +  
  7.    "Type = " + browser.Type + ","  
  8.    + "Version = " + browser.Version + ","  
  9.    + "Major Version = " + browser.MajorVersion + ","  
  10.    + "Minor Version = " + browser.MinorVersion + ","  
  11.    + "Platform = " + browser.Platform+ ","  
  12.    + "Is Beta = " + browser.Beta + ","  
  13.    + "Is Crawler = " + browser.Crawler + ","  
  14.    + "Is AOL = " + browser.AOL + ","  
  15.    + "Is Win16 = " + browser.Win16 + ","  
  16.    + "Is Win32 = " + browser.Win32 + ","  
  17.    + "Supports Frames = " + browser.Frames + ","  
  18.    + "Supports Tables = " + browser.Tables + ","  
  19.    + "Supports Cookies = " + browser.Cookies + ","  
  20.    + "Supports VBScript = " + browser.VBScript +","  
  21.    + "Supports JavaScript = " + ","+  
  22.    browser.EcmaScriptVersion.ToString() + ","  
  23.    + "Supports Java Applets = " + browser.JavaApplets + ","  
  24.    + "Supports ActiveX Controls = " + browser.ActiveXControls  
  25.    + ","  
  26.    + "Supports JavaScript Version = "+  
  27.    browser["JavaScriptVersion"] ;  
  28.    return browserDetails;  
  29. }