0

I have attribute for filter route. when I submit a form I want redirect to another controller with a filter attribute.

My filter attribute name is spam attribute. Now I have a code for change route

public override void OnActionExecuting(ActionExecutingContext filterContext)
{
    filterContext.Result = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary(new { controller = "Error", action = "Index", ErrorCode = System.Net.HttpStatusCode.BadRequest, Handler = "Controller" }));

    base.OnActionExecuting(filterContext);
}

Now when I submit a form my filter is correct fine and I can redirect to Error controller but my page not change or not execute error page for me.

The problem is that the previous page stays
and
In the meantime, I've used Ajax Begin Form to submit form

Nkosi
  • 235,767
  • 35
  • 427
  • 472
Amin Saadati 2
  • 95
  • 1
  • 10

0 Answers0