Tuesday, February 14, 2012

Show Browser information using ASP.Net


Show  Browser information using ASP.Net



Add the following code in your ASP.Net page

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class browser : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        System.Web.HttpBrowserCapabilities browserDetection = Request.Browser;
        Response.Write("Browser type "+ browserDetection.Type+"<br>");
        Response.Write("Browser name " + browserDetection.Browser + "<br>");
        Response.Write("Browser version " + browserDetection.Version + "<br>");
        Response.Write("Cookie support "+ browserDetection.Cookies.ToString());
        Response.Write("Browser JavaScript Version"+ browserDetection.EcmaScriptVersion.ToString());

    }
}

No comments:

Post a Comment