ASP.Net写的浏览器间谍
2024-07-10 13:07:58
供稿:网友
下面是我写的一个关于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="evenrow" bgcolor="skyblue">
<td width="50%"><b>cdf:</b></td>
<td width="50%"><asp:label runat="server" id="cdf" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>cookies:</b></td>
<td width="50%"><asp:label runat="server" id="cookies" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>crawler:</b></td>
<td width="50%"><asp:label runat="server" id="crawler" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>frames:</b></td>
<td width="50%"><asp:label runat="server" id="frames" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>javaapplets:</b></td>
<td width="50%"><asp:label runat="server" id="javaapplets" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>javascript:</b></td>
<td width="50%"><asp:label runat="server" id="javascript" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>majorversion:</b></td>
<td width="50%"><asp:label runat="server" id="majorversion" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>minorversion:</b></td>
<td width="50%"><asp:label runat="server" id="minorversion" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>platform:</b></td>
<td width="50%"><asp:label runat="server" id="platform" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>tables:</b></td>
<td width="50%"><asp:label runat="server" id="tables" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>type:</b></td>
<td width="50%"><asp:label runat="server" id="type" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>vbscript:</b></td>
<td width="50%"><asp:label runat="server" id="vbscript" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>version:</b></td>
<td width="50%"><asp:label runat="server" id="version" /></td>
</tr>
<tr class="oddrow">
<td width="50%"><b>win16:</b></td>
<td width="50%"><asp:label runat="server" id="win16" /></td>
</tr>
<tr class="evenrow" bgcolor="skyblue">
<td width="50%"><b>win32:</b></td>
<td width="50%"><asp:label runat="server" id="win32" /></td>
</tr>
</table>
</form>
</body>
</html>