2012年5月20日

<VB> 檢視網頁原始碼






目前這個程式無法顯示中文字部分


Imports System.Net
Imports System.IO

Public Class Form1

    Private Sub btnView_Click(sender As System.Object, e As System.EventArgs) Handles btnView.Click
        Dim request As Net.WebRequest
        Dim response As Net.WebResponse
        request = WebRequest.Create(txtWebsite.Text)
        request.Credentials = CredentialCache.DefaultCredentials
        response = request.GetResponse()
        Dim dataStream As Stream = response.GetResponseStream()
        Dim reader As New StreamReader(dataStream)

        Dim responseFromServer As String = reader.ReadToEnd()
        txtContent.Text = responseFromServer
        reader.Close()
        dataStream.Close()
        response.Close()

    End Sub
End Class

參考資料:MSDN WebRequest類別(System.Net)

1 則留言:

  1. Casino App, iOS, Android & more | JT Hub
    JTG provides a seamless and easy way 동두천 출장마사지 to 당진 출장안마 access the online 춘천 출장샵 casino for real money, 의왕 출장샵 from your phone and iPod touch to your desktops or your PC. 남원 출장안마

    回覆刪除