您的位置:首页 > 产品设计 > UI/UE

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: