core icon indicating copy to clipboard operation
core copied to clipboard

Redirect to new route OnActionExecuting method MVC .NET CORE 5

Open adnanjalloh opened this issue 5 years ago • 0 comments

Description

I have an issue that the request redirected too many times and I just want to go to new redirect route, so how can I prevent that or is there something that I am not aware of?

this my code

public class AuthController : Controller
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {

        base.OnActionExecuting(filterContext);

        if (GoToLogin)
         {
            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary
            {
                {"controller", "account"},
                {"action", "login"}
            });
        }
    }

Configuration

.NET 5

Regression?

Other information

adnanjalloh avatar Mar 21 '21 21:03 adnanjalloh