zoukankan
html css js c++ java
从Discuz!NT v2.0扣出来的生成静态页面的方法
asp.net下生成静态页的方法有很多,目前我尝试过的方法4-5种,前几天在看Discuz!NT v2.0的源码时,发现了下面的代码。原理很简单,不啰唆了,直接看代码好了:
///
<summary>
///
转换为静态html
///
</summary>
public
void
transHtml(
string
path,
string
outpath)
{
Page page
=
new
Page();
StringWriter writer
=
new
StringWriter();
page.Server.Execute(path, writer);
FileStream fs;
if
(File.Exists(page.Server.MapPath(
""
)
+
"
"
"
+
outpath))
{
File.Delete(page.Server.MapPath(
""
)
+
"
"
"
+
outpath);
fs
=
File.Create(page.Server.MapPath(
""
)
+
"
"
"
+
outpath);
}
else
{
fs
=
File.Create(page.Server.MapPath(
""
)
+
"
"
"
+
outpath);
}
byte
[] bt
=
Encoding.Default.GetBytes(writer.ToString());
fs.Write(bt,
0
,bt.Length);
fs.Close();
}
查看全文
相关阅读:
luogu P1451 求细胞数量
P1443 马的遍历
luogu P1194 买礼物
codevs 4919 线段树练习4
printf的实型
printf的整型
scanf
printf
c++常用函数
字符类型C++(ascll码表)
原文地址:https://www.cnblogs.com/leeolevis/p/1383188.html
最新文章
程序员找工作经历,一个人在北京工作的艰辛
前端代码实现简书刷阅读量
日历控件input框默认显示当日日期
日历控件input框默认显示当日日期
【程序员交友】祈澈姑娘:假装文艺与代码齐飞的前端妹子
最简单的混合开发教程资料汇总
一个前端妹子的悲欢编程之路
一份来自前端开发工程师的规范简历
2018前端精品面试文章总结
1483. [HNOI2009]梦幻布丁【平衡树-splay】
热门文章
1552/3506. [CQOI2014]排序机械臂【平衡树-splay】
1070. [SCOI2007]修车【费用流】
2120. [国家集训队]数颜色【带修莫队】
4199. [NOI2015]品酒大会【后缀数组+并查集】
4698. [SDOI2008]Sandy的卡片【后缀数组】
1251. 序列终结者【平衡树-splay】
4196. [NOI2015]软件包管理器【树链剖分】
2251. [2010Beijing Wc]外星联络【后缀数组】
1031. [JSOI2007]字符加密【后缀数组】
P2670 扫雷游戏
Copyright © 2011-2022 走看看