Tuesday, May 15, 2012

Browser Capabilities in Asp.Net


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="Default1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Browser Capabilities in Asp.Net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>


*************************************************************************************

using System;

public partial class _Default1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Web.HttpBrowserCapabilities browserCapabilities = Request.Browser;
string s = "

Browser Capabilities


"
+
"Type = " + browserCapabilities.Type + "
"
+
"Name = " + browserCapabilities.Browser + "
"
+
"Version = " + browserCapabilities.Version + "
"
+
"Major Version = " + browserCapabilities.MajorVersion + "
"
+
"Minor Version = " + browserCapabilities.MinorVersion + "
"
+
"Platform = " + browserCapabilities.Platform + "
"
+
"Is Beta = " + browserCapabilities.Beta + "
"
+
"Is Crawler = " + browserCapabilities.Crawler + "
"
+
"Is AOL = " + browserCapabilities.AOL + "
"
+
"Is Win16 = " + browserCapabilities.Win16 + "
"
+
"Is Win32 = " + browserCapabilities.Win32 + "
"
+
"Supports Frames = " + browserCapabilities.Frames + "
"
+
"Supports Tables = " + browserCapabilities.Tables + "
"
+
"Supports Cookies = " + browserCapabilities.Cookies + "
"
+
"Supports VBScript = " + browserCapabilities.VBScript + "
"
+
"Supports JavaScript = " +
browserCapabilities.EcmaScriptVersion.ToString()
+ "
"
+
"Supports Java Applets = " + browserCapabilities.JavaApplets + "
"
+
"Supports ActiveX Controls = "
+ browserCapabilities.ActiveXControls
+
"
";
Response.Write(s);

}
}

*************************************************************************************

Post a Comment