Browser Detection in C# (ASP.NET)

September 11, 2008

Do you want to see if User using latest browser  (IE7/FireFox 2  or later)?

System.Web.HttpBrowserCapabilities browser = Request.Browser;
string name = browser.Browser;
float version = (float)(browser.MajorVersion + browser.MinorVersion);
if ((name == “IE” && version >= 7) || (name == “Firefox” && version >= 2))
{
     // You are using IE 7( or later)  or Firexfox 2( or later)
}

obviously you could add other browsers and versions in the condition as you needed!

Advertisements

3 Responses to “Browser Detection in C# (ASP.NET)”


  1. […] admin wrote an interesting post today onHere’s a quick excerptDo you want to see if User using latest browser (IE7/FireFox 2 or later). System.Web.HttpBrowserCapabilities browser = Request.Browser;. string name = browser.Browser;. float version = (float)(browser.MajorVersion + browser. … […]

  2. Eliona Says:

    My comment is entered here


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: