app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
...won't work! Fish out the route like so:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
namespace Cms.Web.Services.Models
{
public class DeRouting
{
IApplicationBuilder app;
public DeRouting(IApplicationBuilder app)
{
this.app = app;
}
public IRouteBuilder GetRoutes()
{
IRouteBuilder routes = new RouteBuilder(app);
routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");
return routes;
}
}
}
No comments:
Post a Comment