2012-05-22 54 views

回答

2
string filepath = img1.ImageUrl;   
using (WebClient client = new WebClient()) 
{ 
     client.DownloadFile(filepath,Server.MapPath("~/Image/apple.jpg")); 
} 
1

你知道圖像路徑嗎?你可以從圖像控制獲取圖像的路徑,然後下載代碼的圖像:

Download image from the site in .NET/C#

using(WebClient client = new WebClient()) 
{ 
    client.DownloadFile("http://www.example.com/image.jpg", localFilename); 
} 
+1

thnxx 的回覆 – KiranSolkar

1

首先獲取圖像的URL,然後使用Web客戶端可以保存文件的文件夾

string filepath = img1.ImageUrl;   
using (WebClient client = new WebClient()) 
{ 
     client.DownloadFile(filepath,Server.MapPath("~/Image/apple.jpg")); 
} 

這會將圖像保存在帶有ImageName蘋果的圖像文件夾中...

+0

@karttik Patel thnx bro .... :) – KiranSolkar

相關問題