·建站首页 ·钻石 ·繁體
您的位置: 中国建站之家 -> 网站开发设计 -> .Net教程 -> 关于如何读取别人的网站使用NGWS NET classes

关于如何读取别人的网站使用NGWS NET classes

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

<%@ Assembly Name="System.Net" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<&#115cript language="VB" runat="server">
dim STRtemp as string
Sub Page_Load(Src As Object, E As EventArgs)
Dim HttpWResp as HTTPWebresponse
Dim sr As StreamReader
'dim STRtemp as string

HttpWReq = WebRequestFactory.Create("http://www.funinspace.com")
HttpWReq.KeepAlive = false
HttpWResp = HttpWReq.GetResponse()
sr = new StreamReader(HttpWResp.GetResponseStream(), Encoding.ASCII)
Try
line=sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
STRtemp=lineENC
do while line <> null
'response.write (lineENC)
line = sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
STRtemp=STRtemp & lineENC
loop
Catch ex As Exception
Response.Write(ex.Message)
End Try

End Sub
</&#115cript>
<html><head>
<title>Scraping A Website</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">Scraped Data</font></h3>
<%response.write (STRtemp)%>
</body></html>

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

上一篇:C#的前途如何?

下一篇:用DataList 控制元件开发的一个简单的留言本程序