扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
一个是一个页面转换的类,该类通过静态函数Changfile()来实现,动态页面到静态页面的转换。
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; using System.IO; /**//// /// Summary description for HtmlProxy /// public class HtmlProxy ...{ public HtmlProxy() ...{ } public static bool ChangeFile(int id) ...{ string filename = HttpContext.Current.Server.MapPath("Post_" + id + ".html"); |
Stream st = GetFileStream(filename); //如果文件存在并且读取成功 if (st != null) ...{ using (st) ...{ StreamToStream(st, HttpContext.Current.Response.OutputStream); return true; //Response.End(); } } else ...{ StringWriter sw = new StringWriter(); HttpContext.Current.Server.Execute("ForumDetail.aspx?PID=" + id, sw); string content = sw.ToString(); |
try ...{ using (FileStream fs = new FileStream( |