Hello,
I'm trying to add an MVC controller to my solution. I've created a folder called a folder called "controller" where I've put my controller, the default class "RouteConfig" which is there when you create a default mvc application, and edited my global.asax to register the areas and the routes.
However I get this exception in Application_BeginRequest when I try to run my website :
System.ArgumentException: 'A route named 'AuthLogin' is already in the route collection. Route names must be unique.'
I've tried some links :
http://doc.dynamicweb.com/documentation-8/how-tos/install-setup/setting-up
http://doc.dynamicweb.com/forum/dynamicweb-9-0-upgrade-issues/using-webapi-with-attribute-routing-in-dw-9-dynamicweb-with-asp-net-mvc
And of course i googled the error extensively, but I can't seem to solve it.
Here's my Application_Start :
public void Application_Start(object sender, EventArgs e)
{
// Fires when the application is started
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
GlobalAsaxHandler.Application_Start(sender, e);
}
RouteCOnfig.cs :
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
My controller :
public class ConfiguratorController : Controller
{
public ActionResult GetProduct()
{
return Json("hello");
}
}
If I remove these two rows from my global.asax, the website runs, but I can't access my controller :
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
I run 9.2.17.
Any idea ?
Thanks