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

ASP.NET
LinQ学习之旅 从整型数组中找出偶数
解析:如何在 ASP.NET 中下载文件
无废话C#设计模式之九:Proxy
Asp.net中实现从弹出窗口中选择值
.Net中给TreeView控件的节点赋id值
ASP.NET 清除 HTML 标记函数
C#之 VS2008 之 Extension Methods
通过 C# 简化 APM
.Net调用Java webservice访问被拒绝解决方案
C#学习之类的访问修饰符
ASP.NET AJAX中的异步Web Services调用
.Net中生成二维的表格的代码
C#中的两个+(plus)操作符解析
Asp.net 2.0的TreeView客户端个性化控制
直接访问WebBrowser控件中的HTML源码
ASP.NET AJAX中的非同步PageMethod调用
利用C#实现分布式数据库查询
Web Services开发体会和在项目中的教训
开发学习之.Net中PE文件的结构
用C#实现启动另一程序的方法

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


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