/Edi.RouteDebugger

ASP.NET Core Middleware to show current route info and all routes

Primary LanguageC#MIT LicenseMIT

ASP.NET Core RouteDebugger Middleware

.NET Core

Show current route info and all routes in an ASP.NET Core application

Background

Inspired by .NET Framework version of the origional RouteDebugger: https://haacked.com/archive/2008/03/13/url-routing-debugger.aspx/

We need something similar in .NET Core, with a few differences:

  • Add route info in response header instead of append them in HTML
  • Use JSON over HTML table for better tooling support
  • Use Middleware to make it .NET Corelish

Usage

Install From NuGet

dotnet add package Edi.RouteDebugger

Adding the Middleware

Recommend use in development environment ONLY

If you are using the Developer Exception Page middleware, put this middleware BEFORE the call to app.UseDeveloperExceptionPage() as the exception page would not work otherwise.

if (env.IsDevelopment())
{
    app.UseRouteDebugger();
}

You can also use an overload to specify custom path where the route debugger will be available, for example:

if (env.IsDevelopment())
{
    app.UseRouteDebugger("/tools/route-debugger");
}

View Current Route

  • Open any page in your application
  • View response header

View All Routes

  • Access /route-debugger or your custom path from browser or postman