Razor模板引擎怎么用
发表于:2024-10-13 作者:千家信息网编辑
千家信息网最后更新 2024年10月13日,这篇文章主要为大家展示了"Razor模板引擎怎么用",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"Razor模板引擎怎么用"这篇文章吧。一.工具下载:程序集
千家信息网最后更新 2024年10月13日Razor模板引擎怎么用
这篇文章主要为大家展示了"Razor模板引擎怎么用",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"Razor模板引擎怎么用"这篇文章吧。
一.工具下载:
程序集下载地址:链接: http://pan.baidu.com/s/1hsGJV5y 密码: pfja
适用于visual studio2015程序集下载地址:链接: http://pan.baidu.com/s/1nvn31IL 密码: 4v7h
如果在使用VS2015等更高版本的时候出现"File not Found Exception Cannot Load System.Web.Razor.dll Version=2.0.0"这样的错误,请换用下面附件中的程序集把旧的RazorEginee.dll删掉,然后把 RazorEngine.NET4.0.dll和System.Web.Razor.Net4.0.dll添加到项目引用中。
二.核心代码代码封装:
public static string ParseRazor(HttpContext context, string csHtmlVirtualPath, object model = null) { string fullpath = context.Server.MapPath(csHtmlVirtualPath);//将虚拟路径转换为绝对路径 string cshtml = File.ReadAllText(fullpath); //将整个cshtml代码读取出来 string cacheName = fullpath + File.GetLastWriteTime(fullpath);//返回上次写入指定文件或目录的日期和时间。 string html = Razor.Parse(cshtml, model, cacheName); return html; } ////// 直接将读取的cshtml代码转换完后,直接返回给客户端 /// /// /// /// public static void OutputRazor(HttpContext context, string csHtmlVirtualPath, object model = null) { string html = ParseRazor(context, csHtmlVirtualPath, model); context.Response.Write(html); }
以上是"Razor模板引擎怎么用"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
代码
引擎
模板
内容
程序
篇文章
地址
密码
路径
链接
学习
帮助
客户
客户端
工具
工具下载
文件
日期
时候
时间
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
号码数据库类型
软件开发推广提成
mysql 数据库入门
与数据库交互的自动化测试
数据库链接失败请重新设置
EMBL数据库序列注释
视频服务器架构
2k22无法连接服务器怎么办
统计局网络安全工作责任制
网络安全知识乡村课堂
1.17基岩版模组服务器
网络安全专员考核指标
保障网络安全的非技术方法
苏州推广软件开发产品介绍
软件里的数据库连接
金华营销网络技术有哪些
怎么用数据库怎么找到网站
微生物基因组数据库管理
关于网络安全手抄报内容好的
北京信息化软件开发售后保障
号码数据库类型
网络安全事件通报国家电网
无法访问移动网络安全黑板报
嵌入式软件开发基础教程
数据库数据表字符串类型
服务器维护开关
数据库技术与网页设计
如何删除sql数据库
PHP 用什么 数据库
sql数据库配置远程