当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ASP.NET实现HTTP方式获取功能

ASP.NET
ADO+ 引导数据种类的演变(转自 ms 一)
C#抢鲜快报之FAQ20
通过指定IP地址得到当前的网络上的主机的域名
网上追捕(很多实用的port)
asp+中的发送者是什么意思
一个完整的网上追捕的原程序
C#里操作时间的例子!
查看主机的内存使用情况
asp+中是如何连接数据库ado+的
一个用c#写的扫描asp源码漏洞的应用程序
一个用c#写的扫描asp源码漏洞的应用程序(续)
两个获取http页面的c#函数
asp.net高级教程(一)---asp.net , 还是asp+ ?
asp.net高级教程(二)--- 转换编程思维
asp.net高级教程(三)---对象
asp.net高级教程(三)---实战篇
asp.net高级教程(五)---实战篇(中)
C#消息队列应用程序 -1
C#消息队列应用程序 -2
使用 ASP+ 列表绑定控件(上)

ASP.NET实现HTTP方式获取功能


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

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>"
build.append (lineENC)

do while not IsNothing(line)
line = sr.ReadLine()
lineENC = server.HTMLencode(line) & vbcrlf & "<br>"
build.append (lineENC)
loop
Catch ex As Exception
problem.text =ex.Message
End Try

labelscrape.text=build.ToString()
End Sub
</script>
<html><head>
<title>Scraping A Website</title>
</head>
<body bgcolor="#FFFFFF">
<h3><font face="Verdana">Scraped Data</font></h3>
<asp:label id=problem runat="server"/>

<font face="courier new" size="2">
<asp:label id=labelscrape runat="server"/>
</font>
</body></html>