2013-02-26 94 views
0

我想設置一個網頁,其上有一個小的簡單字符串。沒有圖像,沒有CSS,沒有其他的東西。只是一個不太長的簡單字符串(最多20個字符)。從網頁獲取字符串到C#表單應用程序

什麼是使用C#Form應用程序將該字符串用於程序中的各種不同用途的最佳方式,例如向用戶展示最新版本的軟件啓動時的最佳方式。

回答

1

我會用自己System.Net.WebClient像這樣:

using (var client = new WebClient()) 
{ 
    string result = client.DownloadString("http://www.test.com"); 
    // TODO: do something with the downloaded result from the remote 
} 
0

嘗試使用System.Net.WebClient

 string remoteUri = "http://www.myserver.com/mypage.aspx"; 
     WebClient myWebClient = new WebClient(); 
     string version = myWebClient.DownloadString(remoteUri);