How to track Browser Types and Capabilities in asp.net

This blog tracks the browser (a user viewing a page) types and it's properties.

  <h1>Track Browser Type & Capabilities</h1>
        <asp:Button ID="btnTrack" runat="server" Text="Track Browser" 
            onclick="btnTrack_Click" />
        <br />
        <br />
        <asp:TextBox ID="txtOutput" runat="server" TextMode="MultiLine" Wrap="true" Height="350px" Width="350px" ></asp:TextBox>
    
    </div>

Code behind:

 protected void btnTrack_Click(object sender, EventArgs e)
    {
        System.Web.HttpBrowserCapabilities objbrowser = Request.Browser;
        string s = "Browser Capabilities\n"
            + "Type = " + objbrowser.Type + "\n"
            + "Name = " + objbrowser.Browser + "\n"
            + "Version = " + objbrowser.Version + "\n"
            + "Major Version = " + objbrowser.MajorVersion + "\n"
            + "Minor Version = " + objbrowser.MinorVersion + "\n"
            + "Platform = " + objbrowser.Platform + "\n"
            + "Is Beta = " + objbrowser.Beta + "\n"
            + "Is Crawler = " + objbrowser.Crawler + "\n"
            + "Is AOL = " + objbrowser.AOL + "\n"
            + "Is Win16 = " + objbrowser.Win16 + "\n"
            + "Is Win32 = " + objbrowser.Win32 + "\n"
            + "Supports Frames = " + objbrowser.Frames + "\n"
            + "Supports Tables = " + objbrowser.Tables + "\n"
            + "Supports Cookies = " + objbrowser.Cookies + "\n"
            + "Supports VBScript = " + objbrowser.VBScript + "\n"
            + "Supports JavaScript = " +
                objbrowser.EcmaScriptVersion.ToString() + "\n"
            + "Supports Java Applets = " + objbrowser.JavaApplets + "\n"
            + "Supports ActiveX Controls = " + objbrowser.ActiveXControls
                  + "\n"
            + "Supports JavaScript Version = " +
                objbrowser["JavaScriptVersion"] + "\n";

        txtOutput.Text = s;
    }

Output:
Chrome Browser - 
img1.jpg

Safari Browser - 

img2.jpg

Ebook Download
View all
Learn
View all