how to save sitecore webpage in html file on local disk or server
        Posted  
        
            by 
                Sam
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sam
        
        
        
        Published on 2013-11-07T20:02:36Z
        Indexed on 
            2013/11/08
            9:55 UTC
        
        
        Read the original article
        Hit count: 359
        
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();
Hi ,
I want to save sitecore .aspx page into html file on local disk , but i am getting exception. But if i use any other webpage example(google.com) it works fine.
The exception :
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
InnerException:
Any help. Thanks in advance
© Stack Overflow or respective owner