WebRequest mywebReq ;
WebResponse mywebResp ;
StreamReader sr ;
string strHTML ;
StreamWriter sw;
mywebReq = WebRequest.Create("http://domain/sitecore/content/test/page10.aspx");
mywebResp = mywebReq.GetResponse();
sr = new StreamReader(mywebResp.GetResponseStream());
strHTML = sr.ReadToEnd();
sw = File.CreateText(Server.MapPath("hello.html"));
sw.WriteLine(strHTML);
sw.Close();
你好 ,
我想将 sitecore .aspx 页面保存到本地磁盘上的 html 文件中,但出现异常。但是,如果我使用任何其他网页示例(google.com),它就可以正常工作。
例外:
System.Net.WebException was caught
HResult=-2146233079
Message=The remote server returned an error: (404) Not Found.
Source=System
StackTrace:
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at System.Net.WebClient.DownloadFile(String address, String fileName)
at BlueDiamond.addmodule.btnSubmit(Object sender, EventArgs e) in c:\inetpub\wwwroot\STGLocal\Website\addmodule.aspx.cs:line 97
内部异常:
任何帮助。提前致谢