WebRequest 创建 WebResponse 实例....取得别站网页内容。 (ZZ)
2006-03-31 08:35
477 查看
MSDN:http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemnetwebresponseclasstopic.asp
Private Sub Page_Load()Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
' Initialize the WebRequest.
Dim myRequest As WebRequest = WebRequest.Create("http://www.163.com")
' Return the response.
Dim myResponse As WebResponse = myRequest.GetResponse()
' Code to use the WebResponse goes here.
' Close the response to free resources.
Dim resStream As Stream = myResponse.GetResponseStream()
Dim sr As New StreamReader(resStream, Encoding.UTF8)
Dim str1 As String = sr.ReadToEnd()
myResponse.Close()
TextBox1.Text = str1
Private Sub Page_Load()Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
' Initialize the WebRequest.
Dim myRequest As WebRequest = WebRequest.Create("http://www.163.com")
' Return the response.
Dim myResponse As WebResponse = myRequest.GetResponse()
' Code to use the WebResponse goes here.
' Close the response to free resources.
Dim resStream As Stream = myResponse.GetResponseStream()
Dim sr As New StreamReader(resStream, Encoding.UTF8)
Dim str1 As String = sr.ReadToEnd()
myResponse.Close()
TextBox1.Text = str1
相关文章推荐
- WebRequest 创建 WebResponse 实例....取得别站网页内容。
- C#获取网页内容 (WebClient、WebBrowser和HttpWebRequest/HttpWebResponse)
- 使用HttpWebRequest的POST取得网页内容(异步操作)2篇集合
- 使用HttpWebRequest的POST取得网页内容(异步操作)2篇集合
- 使用HttpWebRequest的POST取得网页内容
- 使用HttpWebRequest的POST取得网页内容(异步操作)
- 使用HttpWebRequest的POST取得网页内容
- httpwebresponse 异步: request.BeginGetRequestStream 报错! 无法发送具有此谓词类型的内容正文。
- HttpWebRequest 和 HttpWebResponse 的应用 (网页下载)
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容
- HttpWebRequest 和 HttpWebResponse 的应用 (网页下载)
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容 。。。。。
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容
- C#如何使用HttpWebRequest、HttpWebResponse模拟浏览器抓取网页内容
- android WebView加载不出网页内容This request has been blocked; the content must be served over HTTPS.
- C#中网页文件下载——HttpWebRequest与HttpWebResponse的使用方法
- 用HttpWebRequest取得网页源码
- Get data from specified URI using WebRequest and WebResponse(读取网页数据并存入对应html文档)
- .Net 下用 WebRequest、WebResponse组件 GET、POST 收发网页