I have a second thing in my 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 });
}
I need to change controller, but the problem is that it is placed in Areas. I tried to change MapRoute to this:
url: "{area}/{controller}/{action}/{id}",
defaults: new { area="Purchase", controller = "Card", action = "Index", id = UrlParameter.Optional });
but it's not working.
Also I have this in AreaRegistration:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Purchase_default",
string.Format("{0}/{{controller}}/{{action}}/{{id}}", AreaNames.Purchase),
new { controller = "Card", action = "Index", id = UrlParameter.Optional });
}
And here I have seen something similar but I didn't got how to use it.
What am I doing wrong and how should it be done?