-2
I have problem of ambiguity, when having controllers, with the same name as, Homecontroller in two areas: Admin and Backoffice is me presenting the problem of ambiguity, I’ve searched enough subject on the NET but nothing talks about it, besides being using Asp.net Core and MVC5
switch (token.Perfil)
{
case 1:
redirection = RedirectToAction("Index", "Home", new { area = "Paciente" });
break;
case 2:
redirection = RedirectToAction("Index", "Home", new { area = "Medico" });
break;
case 3:
redirection = RedirectToAction("Index", "Home", new { area = "Farmacia" });
break;
case 4:
redirection = RedirectToAction("Index", "Home", new { area = "Laboratorio" });
break;
default:
redirection = RedirectToAction("Index", "Home", new { area = "Medico" });
break;
}
My routes:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Login}/{action=Index}/{id?}");
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "areas",
template: "{area:exists}/{controller=Admin}/{action=Index}/{id?}"
);
//routes.MapRoute("areaRoute", "{area:exists}/{controller=Admin}/{action=Index}/{id?}");
//routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
});
What problem is occurring? post and more details....
– Roberto Braga
You must be in conflict in the route mapping table. Post the content of the method
RegisterRoutes
ofHttpApplication
.– Augusto Vasques
I am using Asp.net core does not have Registrarroutes and Httpapplication
– rock.ownar
he owns Routes at startup along with Addmvc... but he doesn’t have the namespace to specify where he should look for homeController
– Leandro Angelo