ASP.Net写的浏览器间谍

网络整理 - 09-16
下面是我写的一个关于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 runat="server" />
</head>
<body>
<form runat="server" method="post">
您的浏览器信息已经完全在我们的掌握中了^&^:<br>
<p><asp:Label runat="server" Font-Bold="True" /></p>
<table bordercolor="black" cellpadding="4" cellspacing="0">
<tr bgcolor="skyblue">
  <td><b>浏览器属性</b></td>
  <td><b>测试结果</b></td>
</tr>
<tr>
  <td><b>ActiveXControls:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>AOL:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>BackgroundSounds:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Beta:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>Browser:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>CDF:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>Cookies:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Crawler:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>Frames:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>JavaApplets:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>javascript:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>MajorVersion:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>MinorVersion:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Platform:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>Tables:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Type:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>vbscript:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Version:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr>
  <td><b>Win16:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
<tr bgcolor="skyblue">
  <td><b>Win32:</b></td>
  <td><asp:Label runat="server" /></td>
</tr>
</table>
</form>
</body>
</html>