How to check Browser behaviour in Asp.Net

Introduction

Before development of Any kind of web site, we need to first check the browser behaviour to implement javascript ,cookies ,css and manny more to implement logic.


Step 1


On Page_Load Event of aspx page, Write the following code to get the Browser Behaviours



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";


 Step 3

Now Write the Output of string "s" variable to with Response.Write() method


Happy Programing



Comments