当前位置导航:炫浪网>>网络学院>>网页制作>>ASP.NET教程

将Asp.net页面输出为HTML

  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"));

  }

相关内容
赞助商链接