自己寫了一個把html中的遠端圖檔儲存到本地程式并能正常顯示的程式,現向大家分享,也希望大家多多提出建議和意見.
使用示例
[test]
public void rmtimgsave()
{
string root = @"d:/projects/getimages/bin/";//這裡是測試檔案的跟路徑
string html = system.io.file.readalltext(root + "test.html");//含有遠端檔案圖檔的html 即src=http://之類的圖檔
string saveto = root;
html = imgget.saveimagesfromhtml(html, "", saveto);圖檔儲存到和頁面相同的目錄下
system.io.file.writealltext(root + "test_ok.html", html, encoding.default);
html = system.io.file.readalltext(root + "test.html");
saveto = root + "imgs";
html = imgget.saveimagesfromhtml(html, "imgs", saveto);//圖檔儲存到imgs目錄下
system.io.file.writealltext(@root + "test_ok_imgs.html", html, encoding.default);
}

<a href="http://www.mysticboy.cn/attachments/month_0709/52007923133823.rar" target="_blank">點選下載下傳此檔案</a>