WebRequest 创建 WebResponse 实例....取得别站网页内容。

MSDN:http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemnetwebresponseclasstopic.asp

  Private Sub Page_Load(ByVal sender As System.ObjectByVal 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
posted @ 2004-09-18 16:43  大力  阅读(2452)  评论(3编辑  收藏  举报