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;
}
/// <summary>
/// 直接将读取的cshtml代码转换完后,直接返回给客户端
/// </summary>
/// <param name="context"></param>
/// <param name="csHtmlVirtualPath"></param>
/// <param name="model"></param>
public static void OutputRazor(HttpContext context,
string csHtmlVirtualPath, object model = null)
{
string html = ParseRazor(context, csHtmlVirtualPath, model);
context.Response.Write(html);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有