Redirect from controller to another controller

39 views Asked by At

How can I redirect to another controller correctly?

Im in the RedeAtendimentoController and I want to redirect to my Index action in the Rede_AtendimentoController

'hierarchy' of my controllers

I already try versions of RedirectToAction and RedirectToRoute but isnt working

RedirectToRoute("Rede_Atendimento") or RedirectToAction("Index", "Rede_Atendimento");

my controller Rede_AtendimentoController have a [RoutePrefix("Rede_Atendimento")]

1

There are 1 answers

2
Rezzen On

You can supply the area in the routeValues parameter. Try this:

return RedirectToAction("LogIn", "Account", new { area = "Admin" });

Or

return RedirectToAction("LogIn", "Account", new { area = "" });

depending on which area you're aiming for.