하나의 중앙 집합보기가있는 여러 사이트를 갖기 위해 내보기가있는 외부 라이브러리를 만들었습니다. 그들은 내용으로 표시되고 항상 복사됩니다.
이 뷰 라이브러리는 내 웹 사이트에서 참조되므로 컴파일시 bin 폴더에 "Views"폴더가 생성됩니다.bin 폴더에서보기로드?
The view 'Index' or its master could not be found. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/bin/Views/Home/Index.aspx
~/bin/Views/Home/Index.ascx
~/bin/Views/Shared/Index.aspx
~/bin/Views/Shared/Index.ascx
잘못 무슨 일이야 :이 화면을 얻을
public class CommonViewLocator: WebFormViewEngine
{
public CommonViewLocator()
{
MasterLocationFormats = new[] {
"~/bin/Views/{1}/{0}.master",
"~/bin/Views/Shared/{0}.master"
};
ViewLocationFormats = new[] {
"~/bin/Views/{1}/{0}.aspx",
"~/bin/Views/{1}/{0}.ascx",
"~/bin/Views/Shared/{0}.aspx",
"~/bin/Views/Shared/{0}.ascx"
};
PartialViewLocationFormats = ViewLocationFormats;
}
}
실행 한 후 :
그 다음이 같은 빠른 사용자 정의 ViewEngine을했다?
또한 bin 폴더에보기가 있다는 것이 이상하게 느껴지고 다른 제안은 환영합니다.
보안은 실제로 제가 생각한 것입니다. 그런데 내가 추측 할 수있는 보안 오류가 발생합니다. 처음부터보기가 없기 때문에 Htmlhelpers가 나를 꺼내지 않을 것입니다 ... –
Htmlhelpers 제안에 의해 Whay가 의미하는 바는 bin 폴더에보기를 전혀 넣지 말고 가능한 경우 외부 라이브러리에서 렌더링되고 반환됩니다. –