How to get Browser detail in c# asp.net

With any HttpRequest through our Asp.Net application we can collect a lot information about client’s browser. We can get this information creating an object of the Browser property of the Request. we can access many properties with this object like: Browser.Type, Browser.Name, Browser.Version etc.
Find the code below for an example:

private void Button1_Click(object sender, System.EventArgs e)
{
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities\n"
+ "Type = " + browser.Type + "\n"
+ "Name = " + browser.Browser + "\n"
+ "Version = " + browser.Version + "\n"
+ "Major Version = " + browser.MajorVersion + "\n"
+ "Minor Version = " + browser.MinorVersion + "\n"
+ "Platform = " + browser.Platform + "\n"
+ "Supports JavaScript Version = " +
browser["JavaScriptVersion"] + "\n";

//here you can set use/ set this values in your code.
}

This article publically inherits: MSDN’s article

Advertisements

Say something : I accept all the "Humer&Critic"

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