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

ASP.NET
Java、C#泛型的一些个人看法
用JScript.net写.net应用程序
.Net Remoting实现定向广播
ASP.NET 与 Ajax 的实现方式
在.NET环境下绘制模糊数学中隶属函数分布图
.Net UCS2 加码最简单的方法
在VS2005中创建并使用MasterPage
无废话C#设计模式之十三:Decorator
用 C# 编程实现读写Binary
无废话C#设计模式之十二:Bridge
无废话C#设计模式之十一:Composite
ASP.NET连接Access和SQL Server数据库
.NET和J2EE该相互学习什么
ASP.NET 2.0功能扩展:跨页提交
巧用escape解决ASP.NET中URL传参乱码问题
理解ASP.NET中的三层结构
解读ADO.NET2.0的十大最新特性
ASP.NET教程:抽象工厂模式
ASP.NET教程:抽象类和接口的比较
C#实现USB接口的程序代码

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


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