我想设置一个网页,上面有一个简单的小字符串。没有图像,没有CSS,没有其他任何东西。只是一个不长的普通字符串(最多20个字符)。
使用C#Form应用程序获取此字符串的最佳方法是将其用于程序中的各种不同用途,例如向人们展示启动它时软件的最新版本。
答案 0 :(得分: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
}
答案 1 :(得分:0)
尝试使用System.Net.WebClient:
string remoteUri = "http://www.myserver.com/mypage.aspx";
WebClient myWebClient = new WebClient();
string version = myWebClient.DownloadString(remoteUri);