当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 关于如何读取别人的网站使用NGWS NET classes

ASP.NET
一个多文档界面的应用程序
asp+ 制作图形
asp.net中的vb7中如何调用dll中的函数
asp.net中的vb7中如何使用socket作一个传送时间的server
asp+发送Email完全手册
用浏览器来接收C# 的程序返回的时间cool!
DataGrid巧用实现目录浏览
asp+中常用的NameSpace的讲解
随机函数生成密码的asp.net版本
强大的数组功能(asp+程序数组功能调用)
如何用asp+获取post的页面的数据
asp+版本简单的留言板的制作(一)
asp+版本简单的留言板的制作(二)
asp+版本简单的留言板的制作(三)
如何在服务器上保存一定时间的信息
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(一)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(二)
一个功能完善的专栏管理的程序->这是asp.net的第二个应用(三)
这是asp.net的第二个应用(四)
这是asp.net的第二个应用(五)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 44 ::
收藏到网摘: n/a

<%@ 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>