Skip to main content

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

Comments

Popular posts from this blog