惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
博客园_首页
T
Tailwind CSS Blog
美团技术团队
博客园 - 叶小钗
Microsoft Security Blog
Microsoft Security Blog
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog

博客园 - 殇

java设计模式基础之设计原则 java--callback GEF七天之第五天 java基础--特殊的String GEF七天之第四天 GEF七天之第三天 GEF七天之第二天 GEF七天之第一天 距离矢量路由算法(最短路Bellman-Ford实现)实现 网络编程--简单实现javaftp服务器 网络编程--ftp客户端的实现(c#版) c#套接字的实现 好东西大家分享: JAVA学习的一些重点 最基础的数据结构(转自程序员杂志) java面试算法题(经典) (转)JSP上传视频后自动转成flv的核心JAVA方法 2008年1月编程语言排名(转) (转)实现struts2的CRUD中的权限控制(二) (转)实现struts2的CRUD中的权限控制(一)
利用Render方法生成静态页
· 2008-01-28 · via 博客园 - 殇

    .net生成静态页的方法有好多种,在实验了n次后,终于找到了一种本人认为最简单最有效的方法,就是利用重写Render方法生成静态页.Render是在运用Html创建给浏览器输出的页面的时候发生的.很简单的一段代码就实现了静态页生成:
    System.IO.StringWriter html = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter tw = new HtmlTextWriter(html);
        base.Render(tw);
        System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath("index.html"), false, System.Text.Encoding.Default);
        sw.Write(html.ToString());
        sw.Close();
        tw.Close();
        Response.Redirect("index.html");

将页面的html传送给生成的新页index.html,就行了.