当前位置: 移动技术网 > IT编程>开发语言>.net > net 把指定 URI 的资源下载到本地

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

2019年04月13日  | 移动技术网IT编程  | 我要评论

中国地理,将军在上迅雷下载,女士毛衣编织图案

 

            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);
            }

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网