Check Browser Name as well as Version C#.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 459

protected void Page_Load(object sender, EventArgs e)
{
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities <br/>"
+ "Type = " + browser.Type + "<br/>"
+ "Name = " + browser.Browser + "<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"] + "<br/><br/>";



Response.Write(s);

switch (browser.Browser.ToUpper().Trim())
{
//opera and chrome user agent is same,
//the browser.Browser will return Chrome value in Opera
case "CHROME": Response.Write("<b>application support your browser</b>"); break;
case "INTERNETEXPLORER": Response.Write("<b>application does not support your browser</b>"); break;
case "FIREFOX": Response.Write("<b>application support your browser</b>"); break;
case "SAFARI": Response.Write("<b>application support your browser</b>"); break;
default: break;
}
}

Comments or Responses

Login to post response