下面是一个关于HttpBrowserCapabilities组件的应用例子。
<html>
<head>
<script runat="server" language="c#">
public void Page_Load(Object Source, EventArgs E)
{
HttpBrowserCapabilities bc= Request.Browser;
Welcome.Text = "您好,您正在使用 " + bc.Browser + " v." + bc.Version + ",你的运行平台是 " + bc.Platform ;
ActiveXControls.Text = bc.ActiveXControls.ToString();
AOL.Text = bc.AOL.ToString();
BackgroundSounds.Text = bc.BackgroundSounds.ToString();
Beta.Text = bc.Beta.ToString();
Browser.Text = bc.Browser.ToString();
CDF.Text = bc.CDF.ToString();
Cookies.Text = bc.Cookies.ToString();
Crawler.Text = bc.Crawler.ToString();
Frames.Text = bc.Frames.ToString();
JavaApplets.Text = bc.JavaApplets.ToString();
JavaScript.Text = bc.JavaScript.ToString();
MajorVersion.Text = bc.MajorVersion.ToString();
MinorVersion.Text = bc.MinorVersion.ToString();
Platform.Text = bc.Platform.ToString();
Tables.Text = bc.Tables.ToString();
Type.Text = bc.Type.ToString();
VBScript.Text = bc.VBScript.ToString();
Version.Text = bc.Version.ToString();
Win16.Text = bc.Win16.ToString();
Win32.Text = bc.Win32.ToString();
}
</script>
<asp:Label id="css1" runat="server" />
</head>
<body>
<form runat="server" method="post">
您的浏览器信息已经完全在我们的掌握中了^&^:<br>
<p><asp:Label runat="server" id="Welcome" Font-Bold="True" /></p>
<table border="1" width="400" bordercolor="black" cellpadding="4" cellspacing="0">
<tr class="EvenRow" bgcolor="skyblue">
<td width="50%"><b>浏览器属性</b></td>
<td width="50%"><b>测试结果</b></td>
</tr>
<tr class="OddRow">
<td width="50%"><b>ActiveXControls:</b></td>
<td width="50%"><asp:Label runat="server" id="ActiveXControls" /></td>
</tr>
<tr class="EvenRow" bgcolor="skyblue">
<td width="50%"><b>AOL:</b></td>
<td width="50%"><asp:Label runat="server" id="AOL" /></td>
</tr>
<tr class="OddRow">
<td width="50%"><b>BackgroundSounds:</b></td>
<td width="50%"><asp:Label runat="server" id="BackgroundSounds" /></td>
</tr>
<tr class="EvenRow" bgcolor="skyblue">
<td width="50%"><b>Beta:</b></td>
<td width="50%"><asp:Label runat="server" id="Beta" /></td>
</tr>
<tr class="OddRow">
<td width="50%"><b>Browser:</b></td>
<td width="50%"><asp:Label runat="server" id="Browser" /></td>
</tr>
<tr class="EvenRow" bgcolor="skyblue">
<td width="50%"><b>CDF:</b></td>
<td width="50