输入图片网址,就可以保存远程图片
解决方案 »
- 新手问题:这conn要不要关闭, 为什么输入conn.以后vs2008没有close() 提示?
- 服务器报错,请问这是什么错误啊?
- 关于vs2005连接sql 2005的问题,在线等。。高手们请进!
- DropdownList 怎么从CheckBoxList得到值
- 在DataGrid中设置了2个连接按钮,怎样分别处按钮理触发时间
- 谁能解决问题,50元+50分答谢。
- DropDownList空件怎么用
- datagird超连接加多个参数的问题
- 我把.Net FrameWork从1.0升级为了1.1,但是原有的水晶报表无法使用了,怎么办丫?
- 无法从web服务器获取项目文件,什么原因?
- vs2005让代码编辑窗口自动换行的快捷键是什么?
- 如何用实现,将本地服务器上的一些文件,复制到另一个服务器对应的目录里。(除了用FTP还有什么方法??)
WebClient wc=new WebClient();
wc.DownloadFile(src,FileName);
wc.DownloadFile(src,FileName);
src:远程图片的地址
FileName:在本地保存的文件名System.Net类库下
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);