我希望在一个继承至IHtppHandler的类的ProcessRequest方法中根据用户请求的context处理页面:IHttpHandler handler = BuildManager.CreateInstanceFromVirtualPath(@"~\" + pageURL, typeof(System.Web.UI.Page)) as IHttpHandler;
handler.ProcessRequest(context);然后我希望把生成的客户端页面在服务器端以文件的形式保存下来。该怎么做呢?
handler.ProcessRequest(context);然后我希望把生成的客户端页面在服务器端以文件的形式保存下来。该怎么做呢?
System.Web.UI.HtmlTextWriter htw = new HtmlTextWriter(sb);
((Page)Context.Handler).RenderControl(htw);
Response.Write(sb.ToString());
这一句会引发异常吧。类型转换会失败!