首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

WebClient具体如何用 有什么效果 求。

2012-01-28 
WebClient具体怎么用 有什么效果 求高手指点。。rt[解决办法]WebClient像一个网页发送请求,可以返回文本,文

WebClient具体怎么用 有什么效果 求高手指点。。
rt

[解决办法]
WebClient像一个网页发送请求,可以返回文本,文件等
[解决办法]
Provides common methods for sending data to and receiving data from a resource identified by a URI.

string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource,fileName);
Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);
[解决办法]
中文的

http://msdn.microsoft.com/zh-cn/library/system.net.webclient(v=vs.80).aspx

热点排行