Вопрос

это мой старый код

<Ч>
    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"];

Другие советы

К вашему сведению, начиная с RC1, вы делаете это так:

filterContext.ActionDescriptor.ActionName
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top