net 把指定 URI 的资源下载到本地

            DirectoryInfo dir = new DirectoryInfo(AppContext.BaseDirectory);
            var path = dir.FullName + @"tempFile";
            var filePath = path + Guid.NewGuid() + fileName;
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);
            using (WebClient client = new WebClient())
            {
               // address:从中下载数据的 URI,www.xxxx.com/xx.jpg
               // filePath:从中下载数据的 URI,C:\tempFile\xx.jpg
                client.DownloadFile(address, filePath);
            }
原文地址:https://www.cnblogs.com/Cailf/p/10694973.html