Excess redirection ASP NET MVC

Asked

Viewed 1,226 times

0

I have a problem in the project, when accessing the default route, returns me the following error.

Esta página não está funcionando

Redirecionamento em excesso por localhost
Tente limpar os cookies.
ERR_TOO_MANY_REDIRECTS

The error happens when in my index, I redirect to another view other’s controller, if I give return View() everything works.

namespace Portal.Web.Client.Controllers
{
    [RoutePrefix("")]
    [Route("{action=index}")]
    public class HomeController : Controller
    {
        [Route("")]
        [Route("index")]
        public ActionResult Index()
        {
            //algumas coisas

            if(condicao)
                return RedirectToAction("sign-in","user"); // fica "chamando" este método (Action) infinita vezes.
            else
                return View(); //tudo funciona
        }
    }
}

Does anyone have any suggestions as to why this is happening, and how to resolve?

1 answer

0


After reading this one so-en issue, changed the

return RedirectToAction("sign-in","user");

for

 return Redirect("~/user/sign-in");

and it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.