
 
 | 
| 技术资料  > .Net专区 > Asp.Net开发 : 关于如何读取别人的网站使用NGWS NET classes |  
关于如何读取别人的网站使用NGWS NET classes March 25,2004 |  
<%@ Assembly Name="System.Net" %> 
<%@ Import Namespace="System.Net" %> 
<%@ Import Namespace="System.IO" %> 
<script 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 
</script> 
<html><head> 
<title>Scraping A Website</title> 
</head> 
<body bgcolor="#FFFFFF"> 
<h3><font face="Verdana">Scraped Data</font></h3> 
<%response.write (STRtemp)%> 
</body></html> 
         
         |  
 
 | 
  
Copyright © 2001-2008 Shenzhen Hiblue Software Team All rights reserved