Razor 템 플 릿 엔진 소개
프로그램 다운로드 주소:링크:http://pan.baidu.com/s/1hsGJV5y비밀번호:pfja
visual studio 2015 프로그램 집합 다운로드 주소:링크:http://pan.baidu.com/s/1nvn31IL비밀번호:4v7h
VS 2015 등 더 높 은 버 전 을 사용 할 때"File not Found Exception Cannot Load System.Web.Razor.dll Version=2.0.0"과 같은 오류 가 발생 하면 다음 첨부 파일 의 프로그램 집합 으로 오래된 Razor Egine.dll 을 삭제 한 다음 Razor Engine.NET 4.0.dll 과 System.Web.Razor.Net 4.0.dll 을 항목 참조 에 추가 하 십시오.
2.핵심 코드 패키지:
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);
}
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
ASP.NET MVC Razor 설명 레이아웃ASP.NET MVC를 배우고 있는 노트다. 일반 레이아웃과 레이아웃에 대한 인용 ASP.NET MVC 템플릿으로 프로젝트를 제작할 때 공동 레이아웃의 파일 등이 만들어집니다. 구성은 다음과 같다.Views 아래만 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.