View route information for AspNetCore projects.
Given that routes are registered with the (new since 3.0) AspNetCore IEndpointRouteBuilder (aka convention based), like below;
app.UseEndpoints(endpoints => { ...
or through the usual route-related Attributes (aka attribute based);
[Area("Dashboard")]
[Route("[area]/{collectionId?}/[controller]/[action]/{id?}")]
public class GridController : Controller {
...
Stable | CI | |
---|---|---|
AspNetCore.DisplayRoutes | GPR |
AspNetCode.DisplayRoutes can add an additional route to your application where, when visited, will report all registered routes in your application.
#Package manager
Install-Package AspNetCore.DisplayRoutes
or
#CLI
dotnet add package AspNetCore.DisplayRoutes
For more options see NuGet
Create an additional route using the default/predefined options;
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
...
app.UseEndpoints(endpoints => {
...
endpoints.PrintRoutes();
...
Or override default options;
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
...
app.UseEndpoints(endpoints => {
...
endpoints.PrintRoutes(o => {
o.Renderer = new AspNetCore.DisplayRoutes.Render.HtmlRenderer();
o.Pattern = "/myroutes";
});
...
Option | Default | |
---|---|---|
Pattern | The route path where the route report will be provided | /routes |
HttpMethods | Allowed HTTP methods for the registered route path | ["GET"] |
Renderer | The format the routes will be presented | UnicodeBoxRenderer |
ContentType | ||
---|---|---|
AsciiBoxRenderer | text/plain; charset=UTF-8 | |
HtmlRenderer | text/html; charset=UTF-8 | |
JsonRenderer | application/json | |
UnicodeBoxRenderer | text/plain; charset=UTF-8 |