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

ASP.NET
ASP.NET ViewState 初探 (2)
.net中即时消息发送的实现
改写即时消息的发送 包含同时给多人发送信息
asp.NET特写
TreeView使用笔记
ASP.Net中自定义Http处理及应用之HttpHandler篇
Asp.net+Xml实现无数据库论坛一点即通
ASP.NET HTTP运行时组成详解
在ASP.NET 2.0中使用页面导航控件
ASP.net组件编程中的两种事件编写方法
保存图片流到数据库之后固定显示新法
asp.net 2.0中一次性更新所有GRIDVIEW的记录
ASP.NET创建Web服务之设计方针
用ASP.Net(C#)连接Oracle数据库的方法
ASP.Net环境下使用Jmail组件发送邮件
通过探测邮件服务器进行Email地址有效性检验
如何在上传的图片上打自己的文字水印
ASP.NET的14个热点问题解答
.NET中如何取得IP或者用户名等信息
ASP.NET中使用数据处理插入数据注意的问题

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 114 ::
收藏到网摘: 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>