首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

用HttpWebRequest提取网页中的内容的有关问题

2012-06-30 
用HttpWebRequest提取网页中的内容的问题我看到了:http://www.legalsoft.com.cn/docs/docs/12/732.html这

用HttpWebRequest提取网页中的内容的问题
我看到了:
http://www.legalsoft.com.cn/docs/docs/12/732.html
这里面说的好像很简单,我就试了试,结果报错了

VB.NET code
Imports System.IOImports System.NetPublic Class Form1    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim url As String = "http://www.baidu.com " '这是tuenhai的小站,有空来坐坐         Dim httpReq As System.Net.HttpWebRequest        Dim httpResp As System.Net.HttpWebResponse        Dim httpURL As New System.Uri(url)        httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)        httpReq.Method = "GET"       [color=#FF0000] httpResp = CType(httpReq.GetResponse(), HttpWebResponse)[/color]        httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与 Internet 资源建立持久连接。         Dim reader As StreamReader = _        New StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding("GB2312"))        Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码     End SubEnd Class


红字部分:
An unhandled exception of type 'System.Net.WebException' occurred in system.dll

Additional information: The remote server returned an error: (407) Proxy Authentication Required.

大家说说,怎么办啊

还有我想查看respHTML的值,但是断点断到这句还没执行,下面又没语句了,怎么add watch啊 
vb我刚学的 大家多包涵啊

[解决办法]
探讨
帮顶,可惜我不懂VB.NET

热点排行