Question

c'est mon ancien code

    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;
    }
Était-ce utile?

La solution

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

Autres conseils

Pour votre information, à partir de RC1, vous le faites comme suit:

filterContext.ActionDescriptor.ActionName
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top