首页 > 代码库 > asp.net获取当前页面源码并生成静态页面

asp.net获取当前页面源码并生成静态页面

StringWriter stringWriter = new StringWriter();HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);this.Page.RenderControl(htmlWriter);string html = stringWriter.GetStringBuilder().ToString();string path = HttpContext.Current.Server.MapPath("~/cache/index.htm");File.WriteAllText(path, html, System.Text.Encoding.Default);

 

asp.net获取当前页面源码并生成静态页面