·建站首页 ·钻石 ·繁體
您的位置: 中国建站之家 -> 网站开发设计 -> .Net教程 -> asp+ 如何跨站抓取 页面

asp+ 如何跨站抓取 页面

作者:未知  来源:转载  发布时间:2005-7-20 10:04:26  发布人:acx

*
豆腐制作 都是精品
http://www.asp888.net 豆腐技术站
如果您转贴 本文 请 保留版权信息
*/
豆腐在以前的文章中 讲过 如何用 PHp 和 Asp 跨站抓取别的站点的页面,今天我们来测试一下 asp+
是怎么实现 跨站抓取 别的站点的页面
Code Listing
<%@ Assembly Name="System.Net" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<&#115cript language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim HttpWResp as HTTPWebresponse
Dim sr As StreamReader
dim STRtemp as string
text1.text = ""
HttpWReq = WebRequestFactory.Create("http://www.asp888.net")
HttpWReq.KeepAlive = false
HttpWResp = HttpWReq.GetResponse()
sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)
Try
line=sr.ReadLine()
do while line <> null
line = sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
text1.text = text1.text & lineENC
loop
Catch ex As Exception
text1.text = "发生错误: " & ex.Message
End Try

End Sub
</&#115cript>
<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>

作者:豆腐()

将本文收藏到QQ书签与更多好友分享

上一篇:在ASP+ 中我们如何使用 Class 而不是组件

下一篇:在 ASp+ 中的一些可能会用到的 小函数