0
"SomeController"というコントローラがあります。私は、ユーザーがログインしているかどうか、またはそのコントローラで何らかのアクションを実行しようとしているのかどうかをチェックしたいと思います。そうするために、私はその記事http://blog.wekeroad.com/blog/aspnet-mvc-securing-your-controller-actions/を読んで、私は自分のクラス(テスト)を書いた:ASP.NET MVC 2 OnActionExecutingメソッドの問題
public class BaseFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
{
FormsAuthentication.RedirectToLoginPage();
}
//here will be checking the user permissions if he's logged in
}
}
[BaseFilter]
public class SomeController : BaseController
{
...
}
をしかし、あなたが理解できるように私は、そのコントローラから任意のアクションを実行したいときには、不定詞のループを作ります。では、それにどのように対処するのですか?