問題
使用 WebClient下載其他網站的資料
解決方法
public string GetHtmlCodeSaved(string savePath,string saveFileName)
{
if (savePath.Length == 0)
throw new ArgumentException("Save Path can't empty!");
if (saveFileName.Length == 0)
throw new ArgumentException("Save File Name can't empty!");
try
{
using (WebClient client = new WebClient())
{ string localPath = savePath + saveFileName;
client.DownloadFile(htmlAddress, localPath);
return localPath;
}
}
catch (Exception ex)
{
throw ex;
}
}
沒有留言:
張貼留言