문제

이것은 나의 오래된 코드입니다


    protected override bool OnPreAction(string actionName, System.Reflection.MethodInfo methodInfo)
    {
        if ("|Register|RegisterPage|Login|LoginPage|Logout|Service".ToLower().Contains(actionName.ToLower()))
        {
            return base.OnPreAction(actionName, methodInfo);
        }

        Customer = CustomerHelper.GetCustomer();

        if (Customer.IsSeccessedLogin())
        {
            return base.OnPreAction(actionName, methodInfo);
        }

        Response.Redirect("Login.html");
        return false;
    }
도움이 되었습니까?

해결책

string actionName = (string)filterContext.RouteData.Values["action"];

다른 팁

FYI, RC1 기준으로는 다음과 같이합니다.

filterContext.ActionDescriptor.ActionName
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top