将Asp.net页面输出为HTML

2013 年 8 月 5 日3850

  c#代码:

WebRequest mywebrq;

WebResponse mywebresp;

StreamReader sr;

Streamwriter sw;

Private void Page_Load(object sender,EventArgs e)

{

mywebreq=WebRequest.Create(http://localhost/Test.aspx);

mywebresp=mywebreq.GetResponse();

sr=new streamReader(mywebresp.GetResponsestream());

strHTML=sr.ReadToEnd();

sw=File.CreateText(server.mappath("Test.htm"));

sw.writeling(strHTML);

sw.close();

Response.writeFile(Server.Mappath("Test.htm"));

}

查看本文来源

0 0