I have an ASP.NET Core 3.1 MVC app, I have in my startup.cs file the predefined call:
app.UseEndpoints(endpoints =>
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
in the Configure() method.
This is to route every undefined url to the Home/Index action.
I want to add another endpoint mapping that allows me to route any request that corresponds to the pattern:
{controller}/{action}
to the specified controller/action method.
I know this was easy in ASP.NET MVC where you just added the related url in the routing file :
Route.add (
name : "routename",
url : "{controller}/[action}/{id?}"
)
Is there a similar, easy way to do it with ASP.NET Core 3.1?
startup.cslike you described?endpoints.MapControllerRouteinsideapp.UseEndpoints. Check this documentation, it will be helpful learn.microsoft.com/en-us/aspnet/core/mvc/controllers/….