Как я могу получить actionName в ActionFilter & # 65311;
-
05-07-2019 - |
Вопрос
это мой старый код
<Ч> 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
Не связан с StackOverflow