WebClient wc = new WebClient();
string url = "http://www.youkuaiyun.com/Images/logo_csdn.gif";
string newName = Server.MapPath("~/" + DateTime.Now.Ticks.ToString() + url.Substring(url.LastIndexOf('.')));
wc.DownloadFile(url, newName);
wc.Dispose();
本文介绍了一种使用C#中的WebClient类从指定URL下载文件的方法。通过实例代码展示了如何生成唯一的文件名并完成文件的下载过程。
798

被折叠的 条评论
为什么被折叠?



