Greame、
あなたは(これは、ASPXプロジェクトから取られているが、かみそりのために微調整できるはずです)、あなたのベースコントローラでこのような何かを試すことができます。
protected override ViewResult View(string viewName, string masterName,
object model)
{
// we share some views that aren't partialviews
// therefore, we have to ensure that the Shareholder view
// is ALWAYS attached to the logged in user if they aren't an admin user
bool userIsAdmin = IsAuthorised(new[] { "Admin" });
if (!userIsAdmin && !string.IsNullOrEmpty(
ControllerContext.HttpContext.User.Identity.Name))
{
masterName = "Shareholder";
}
return base.View(viewName, masterName, model);
}
この例では、ユーザーが広告でない場合は、最初に定義されたマスターテンプレート名(Site.Master)の値が 'Shareholder'(Shareholder.Master)に変更されます分のユーザー。
完了しました:)ありがとうございました – GraemeMiller
グレーム - それはとても簡単な修正でした。質問は「鐘を鳴らした」と私のTFSが上記を明らかにした速い検索th !! :) –
ええ私はそれがそれのようなものだと感じていたが、我々は本当にプロジェクトに押し込まれているので、誰かが私がそれを書くことができるより速く知っていると思った:) – GraemeMiller