豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
*/
豆腐在以前的文章中 讲过 如何用 PHp 和 Asp 跨站抓取别的站点的页面,今天我们来测试一下 asp+
是怎么实现 跨站抓取 别的站点的页面
Code Listing
1@ Assembly Name="System.Net"
1@ Import Namespace="System.Net"
1@ Import Namespace="System.IO"
1<script language="VB" runat="server">
2Sub Page_Load(Src As Object, E As EventArgs)
3Dim HttpWResp as HTTPWebresponse
4Dim sr As StreamReader
5dim STRtemp as string
6text1.text = ""
7HttpWReq = WebRequestFactory.Create("http://www.asp888.net")
8HttpWReq.KeepAlive = false
9HttpWResp = HttpWReq.GetResponse()
10sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)
11Try
12line=sr.ReadLine()
13do while line <> null
14line = sr.ReadLine()
15lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
16text1.text = text1.text & lineENC
17loop
18Catch ex As Exception
19text1.text = "发生错误: " & ex.Message
20End Try
21
22End Sub
23</script>
1<html><head>
2<title>跨站</title>
3</head>
4<body bgcolor="#FFFFFF">
5<h3><font face="Verdana">抓来得数据</font></h3>
6<asp:textbox id="text1" rows="40" runat="server" textmode="multiline" width="600px"></asp:textbox>
7</body></html>
作者:豆腐()