将Asp.net页面输出为HTML
1 WebRequest mywebrq;
2 WebResponse mywebresp;
3 StreamReader sr;
4 Streamwriter sw;
5
6 Private void Page_Load(object sender,EventArgs e)
7 {
8 mywebreq=WebRequest.Create(aspx">http://localhost/Test.aspx);
9 mywebresp=mywebreq.GetResponse();
10 sr=new streamReader(mywebresp.GetResponsestream());
11 strHtml=sr.ReadToEnd();
12 sw=File.CreateText(server.mappath("Test.htm"));
13 sw.writeling(strHtml);
14 sw.close();
15 Response.writeFile(Server.Mappath("Test.htm"));
16 }
2 WebResponse mywebresp;
3 StreamReader sr;
4 Streamwriter sw;
5
6 Private void Page_Load(object sender,EventArgs e)
7 {
8 mywebreq=WebRequest.Create(aspx">http://localhost/Test.aspx);
9 mywebresp=mywebreq.GetResponse();
10 sr=new streamReader(mywebresp.GetResponsestream());
11 strHtml=sr.ReadToEnd();
12 sw=File.CreateText(server.mappath("Test.htm"));
13 sw.writeling(strHtml);
14 sw.close();
15 Response.writeFile(Server.Mappath("Test.htm"));
16 }