Redirect to a controller in another area

2

I tried a solution for this but I could not, I'm trying to redirect session errors to login, my application stays inside a folder called Areas and when I see something redirect to it I redirect it like this:

  <li><a  href="@Url.Action("Enviadas", "Mensagem", new {PaginaAtual = 0, area = "Lojista" })"><i class="fa fa-envelope-o"></i>Enviadas</a></li>

But after I'm inside it I need to redirect to the login, which is in the Controllers folder outside the areas folder, (Controller and Areas are on the same level)

I'm trying to redirect like this:

if (loja == null)
{
    return RedirectToAction("Index", "Login", new {area = "~/Controllers" });
}

But this is giving route problem, if anyone knows me respond I will be grateful.

EDIT: At the moment I try to redirect I am in the DashBoard Controller which is in ~/Areas/Lojista/Dashboard , and I need to redirect to the login, which is outside of Areas, which would be ~/Login In this case the login is in the folder of normal ASP.net controllers and the rest is in ~/Areas/Lojista

    
asked by anonymous 11.10.2016 / 19:27

1 answer

2

Just pass the empty area parameter. This will cause the Controller to be searched in the root area.

return RedirectToAction("Index", "Login", new {area = "" });
    
11.10.2016 / 19:30