生成静态化页面
2015-09-26 21:09
309 查看
string html = RPHelper.ParseRazor(HttpContext.Current, "~/NewsMgr/ViewNews.cshtml", new { Title=title,Body=body }); //从配置文件(web.config)中读取静态页生成路径 string newStaticDir = ConfigurationManager.AppSettings["NewsStaticDir"]; string fullPath = newStaticDir +categoryId + @"\" + id+".shtml"; string htmlDir = Path.GetDirectoryName(fullPath); if (!Directory.Exists(htmlDir))//文件夹不存在,则创建 { Directory.CreateDirectory(htmlDir); } File.WriteAllText(fullPath, html);
相关文章推荐
- 多态性Polymorphism
- 软件测试知识点整理
- sqlite的基础误区
- 用table表格建立一个课程表
- 约瑟夫环问题
- UGUI 快捷键创建UGUI组件
- jspsmart上传图片到Tomcat
- Peeking Iterator
- hdoj 5478 Can you find it
- [Qt] Mask 蒙版
- 黑马程序员-----java基础(网络编程)
- 【今日推荐】10大流行的 Metro UI 风格的 Bootstrap 主题和模板
- JavaScript高级程序设计之引用类型之RegExp 类型第5.4讲笔记
- JSP编码问题
- CodeVS1513 皇帝的烦恼
- LeetCode——Ugly Number
- [Qt] Mask 蒙版
- Learning Spark - LIGHTNING-FAST DATA ANALYSIS 第三章 - (3)
- 【转】电子商务网站测试经验总结
- 系统性能指标