WebRequest 创建 WebResponse 实例....取得别站网页内容。
2004-09-18 16:43
579 查看
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 实例....取得别站网页内容。 (ZZ)
- 使用HttpWebRequest的POST取得网页内容(异步操作)2篇集合
- C#获取网页内容 (WebClient、WebBrowser和HttpWebRequest/HttpWebResponse)
- 使用HttpWebRequest的POST取得网页内容(异步操作)
- 使用HttpWebRequest的POST取得网页内容(异步操作)2篇集合
- 使用HttpWebRequest的POST取得网页内容
- 使用HttpWebRequest的POST取得网页内容
- C#中网页文件下载——HttpWebRequest与HttpWebResponse的使用方法
- C#如何使用 WebRequest 类请求网页Headers及内容数据源码
- 在web.xml定义,在网页中使用变量实例 使用只有创建变量的servlet才可以访问的<init-param>方式 附带登陆和跳转实现
- spring AOP 取得 web 的 request response 和 session
- c# HttpWebRequest与HttpWebResponse请求网页和返回网页教程
- android WebView加载不出网页内容This request has been blocked; the content must be served over HTTPS.
- 【转载】C#网页采集数据的几种方式(WebClient、WebBrowser和HttpWebRequest/HttpWebResponse)
- wp7使用POST请求Asp.net网页时,HttpWebRequest的BeginGetResponse方法抛出NotSupportException异常的解决方法
- c# HttpWebRequest与HttpWebResponse请求网页和返回网页教程
- C#用HttpWebRequest通过代理服务器验证后抓取网页内容 。。。。。
- HttpWebRequest和HttpWebResponse实例
- HttpWebRequest 和 HttpWebResponse 的应用 (网页下载)