Using System;Using System.Data;Using System.Configuration;Using System.Web;Using System.Web.Security;Using System.Web.UI;Using System.Web.UI.WebControls;Using System.Web.UI.WebControls.WebParts;Using System.Web.UI.HtmlControls;Using System.Text.RegularExpressions;Using System.IO;<summary>///Summary description of Createhtml///ASP. HTML static page generation///Call Method:///New Createhtml (). Nei_create ("http://localhost:4032/new5mdn/default.aspx", "default.htm");</summary>public classCreateHtml:System.Web.UI.page{Public createhtml () {}<summary>//Generate a static page, the build location is under this project</summary>//<param name= "strURL" >The requested URL</param>//<param name= "Strrelpath" >Path and file name created, path is relative path</param>//<returns></returns>public bool Nei_create (String strURL,String Strrelpath) {String Strfilepage; Strfilepage =HttpContext.Current.Server.MapPath (Strfilepage);StreamWriter SW =NullGet the static HTML for ASPXtry {if (File.exists (Strfilepage)) {File.delete (Strfilepage); } SW =NewStreamWriter (Strfilepage,False, System.Text.Encoding.GetEncoding ("gb2312")); System.Net.WebRequest WReq = System.Net.WebRequest.Create (strURL); System.Net.WebResponse wresp = Wreq.getrequeststream (); System.IO.Stream Respstream = Wresp.getresponsestream (); System.IO.StreamReader reader =NewStreamReader (Respstream, System.Text.Encoding.GetEncoding ("gb2312"));String strtemp = reader. ReadToEnd ();Regex R1 =NewRegex ("<input type=\" hidden\ "name=\" __eventtarget\ ".*/>",Regexoptions.ignorecase);Regex r2 =NewRegex ("<input type=\" hidden\ "name=\" __eventargument\ ".*/>",Regexoptions.ignorecase);Regex R3 =NewRegex ("<input type=\" hidden\ "name=\" __viewstate\ ".*/>",Regexoptions.ignorecase);Regex R4 =NewRegex ("<form. *id=\" form1\ ">",Regexoptions.ignorecase);Regex R5 =NewRegex ("</form>");Regex R6 =NewRegex ("<input type=\" hidden\ "name=\" __eventvalidation\ ".*/>",Regexoptions.ignorecase); strtemp = R1. Replace (strtemp,""); strtemp = R2. Replace (strtemp,""); strtemp = R3. Replace (strtemp,""); strtemp = R4. Replace (strtemp,""); strtemp = R5. Replace (strtemp,""); strtemp = R6. Replace (strtemp,""); Sw. Write (strtemp); }CatchException ex) {HttpContext.Current.Response.Write (ex. Message);HttpContext.Current.Response.End ();return false;Build to Error}finally {SW. Flush (); Sw. Close (); SW =Null } }<summary>//Generate a static page, the build location is not under this item</summary>//<param name= "strURL" >The requested URL</param>//<param name= "Strrelpath" >Created path and file name, path is absolute path</param>public bool Wai_create (String strURL,String Strrelpath,string filename) {String Strfilepage; Strfilepage = Strrelpath +"\ \" + filename;StreamWriter SW =NullGet the static HTML for ASPXtry {if (!Directory.Exists (Strrelpath)) {Directory.CreateDirectory (Strrelpath); }if (File.exists (Strfilepage)) {File.delete (Strfilepage); } SW =NewStreamWriter (Strfilepage,False, System.Text.Encoding.GetEncoding ("gb2312")); System.Net.WebRequest WReq = System.Net.WebRequest.Create (strURL); System.Net.WebResponse wresp = Wreq.getresponse (); System.IO.Stream Respstream = Wresp.getresponsestream (); System.IO.StreamReader reader =New System.IO.StreamReader (Respstream, System.Text.Encoding.GetEncoding ("gb2312"));String strtemp = reader. ReadToEnd ();Regex R1 =NewRegex ("<input type=\" hidden\ "name=\" __eventtarget\ ".*/>",Regexoptions.ignorecase);Regex r2 =NewRegex ("<input type=\" hidden\ "name=\" __eventargument\ ".*/>",Regexoptions.ignorecase);Regex R3 =NewRegex ("<input type=\" hidden\ "name=\" __viewstate\ ".*/>",Regexoptions.ignorecase);Regex R4 =NewRegex ("<form. *id=\" form1\ ">",Regexoptions.ignorecase);Regex R5 =NewRegex ("</form>");Regex R6 =NewRegex ("<input type=\" hidden\ "name=\" __eventvalidation\ ".*/>",Regexoptions.ignorecase); strtemp = R1. Replace (strtemp,""); strtemp = R2. Replace (strtemp,""); strtemp = R3. Replace (strtemp,""); strtemp = R4. Replace (strtemp,""); strtemp = R5. Replace (strtemp,catch (exception ex) {httpcontext.current.response.end (); return false; //Build to Error} finally {sw. Flush (); Sw. Close (); SW = null;} return true;} public void Filepicdelete (string path) {System.io.fileinfo file = FileInfo (); if (file. Exists) file. Delete (); }}