- 爱易网页
-
ASP.NET教程
- ASP.Net写的浏览器间谍
日期:2011-03-18 浏览次数:20509 次
下面是我写的一个关于HttpBrowserCapabilities组件的应用例子。
程序执行的例子在 http://aspx1.brinkster.com/feidao/code/BrowserSpy.aspx
下面是源程序:
<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="Ev
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。