源码天下

源码天下 -> 技术文档 -> WEB开发 -> ASP.NET -> 文章内容

使用net classes访问其他网站内容



作者:佚名  来源:pccode.net整理  发布时间:2008-5-10 9:50:25  发布人:wongrs

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
    Try
        Dim objResponse As System.Net.WebResponse
        Dim objRequest As System.Net.WebRequest
        DIM theurlresult as string
        DIM theurl as string = "http://www.funinspace.com"
        objRequest = System.Net.HttpWebRequest.Create(theurl)
        objResponse = objRequest.GetResponse()
        Dim sr As new system.io.StreamReader(objResponse.GetResponseStream())
        theURLresult=server.HTMLencode(sr.ReadToEnd())
        Page.Controls.Add(new LiteralControl(theURLresult))
    Catch ex As Exception
        Page.Controls.Add(new LiteralControl(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>

</body></html>


[] [返回上一页] [打 印] [收 藏]

上一篇文章:ASP.NET中动态修改web.config中的设置项目(前台代码)
下一篇文章:ASP.NET中动态修改web.config中的设置项目(CS页代码)
中国福网提供带宽支持