zoukankan      html  css  js  c++  java
  • ASP.NET Routing Debugger

    http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

    UPDATE: I’ve added a NuGet package named "routedebugger" to the NuGet feed, which will make it much easier to install.

    In Scott Hanselman’s wonderful talk at Mix, he demonstrated a simple little route tester I quickly put together.

    Route Debugger Screenshot

    This utility displays the route data pulled from the request of the current request in the address bar. So you can type in various URLs in the address bar to see which route matches. At the bottom, it shows a list of all defined routes in your application. This allows you to see which of your routes would match the current URL.

    The reason this is useful is sometimes you expect one route to match, but another higher up the stack matches instead. This will show you that is happening. However, it doesn’t provide any information why that is happening. Hopefully we can do more to help that situation in the future.

    To use this, simply download the following zip file and place the assembly inside of it into your bin folder. Then in your Global.asax.cs file add one line to theApplication_Start method (in bold).

    protected void Application_Start(object sender, EventArgs e)
    {
      RegisterRoutes(RouteTable.Routes);
      RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
    }

    This will update the route handler (IRouteHandler) of all your routes to use aDebugRouteHandler instead of whichever route handler you had previously specified for the route. It also adds a catch-all route to the end to make sure that the debugger always matches any request for the application.

    I’m also making available the full source (using the word full makes it sound like there’s a lot, but there’s not all that much) and a demo app that makes use of this route tester. Let me know if this ends up being useful or not for you.

    Technorati Tags: aspnetmvc,ASP.NET,routing
  • 相关阅读:
    FreeRTOS学习目录
    ESP32随笔汇总
    FPGA开发随笔汇总
    manim在windows系统下安装
    16、频率域滤波
    15、频率域滤波基础——傅里叶变换计算及应用基础
    14、OpenCV实现图像的空间滤波——图像锐化及边缘检测
    13、OpenCV实现图像的空间滤波——图像平滑
    12、OpenCV实现图像的直方图处理
    生成预加载镜像以及设备树
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/2954266.html
Copyright © 2011-2022 走看看