ASP.NET MVC Rewrite Action

238 Views Asked by At

View following route:

 context.MapRoute(
        name: "General",
        url: "general/{controller}/{action}/{id}",
        defaults: new { controller = "general", action = "list", id = UrlParameter.Optional },
        namespaces: new[] { "Catalogi.Web.Controllers.General" }
 );

Here you can have the following url routes:

/general/suppliers

Which will take you to the list action.

But the following also works:

/genera/suppliers/list

Is is possible to redirect the second url to the first one? And this for multiple controller names?

Because else you have duplicated urls and I would like to eliminate this.

0

There are 0 best solutions below