سؤال

وهذا هو بلدي القانون القديم


    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