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
{
...
}
을하지만, 당신이 이해할 수있는 나는 그 컨트롤러에서 모든 작업을 실행할 때 그것은 부정사 루프를 만든다. 그럼 어떻게 대처할 수 있을까요?