-1

我如何使用 Visual Basic 从主机服务器读取文本文件?

我们的链接:yourname.com/file.txt

4

1 回答 1

4

使用HttpWebRequest类:

Dim request = DirectCast(WebRequest.Create("http://wordpress.org/extend/plugins/about/readme.txt"), HttpWebRequest)
Dim response = DirectCast(request.GetResponse(), HttpWebResponse)
Using sr As New StreamReader(response.GetResponseStream())
    Do While sr.Peek() >= 0
        Console.WriteLine(sr.ReadLine())
    Loop
End Using
于 2013-01-24T11:37:52.683 回答