http1.aspx

来自「《精通ASP.NET网络编程》附带实例」· ASPX 代码 · 共 32 行

ASPX
32
字号
<%@Import Namespace="System.Net"%>
<%@Import Namespace="System.IO"%>
<script language="VB" runat="server">
 Sub Page_Load(Src As Object, E As EventArgs)
  Dim HttpWResp as Webresponse
  Dim sr As StreamReader
  dim STRtemp as string
  text1.Text = ""
  Dim HttpWReq As WebRequest = WebRequest.Create("http://127.0.0.1")
  HttpWResp = HttpWReq.GetResponse()
  sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)
  Try
   Dim line As String
   line=sr.ReadLine()
   do while line <> ""
   line = sr.ReadLine()
   text1.Text = text1.Text & line & vbcrlf & ""
  loop
  Catch ex As Exception
  text1.Text = "发生错误: " & ex.Message
  End Try
 End Sub
</script>
<html>
<head>
<title>跨站抓取页面</title>
</head>
<body bgcolor="#FFFFFF">
  <h3><font face="Verdana">抓来得数据</font></h3>
  <asp:TextBox id="text1" Width="600px" Textmode="multiline" rows="40" runat="server"/>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?