-1

我刚开始研究 ASP.net MVC。我在 Global.asax 中找到了以下代码。我知道这段代码用于管理应用程序中的路由。但是,我无法理解这段代码:

***routes.IgnoreRoute("{resource}.axd/{*pathInfo}");***

    public static void RegisterRoutes(RouteCollection routes)
    {
        ***routes.IgnoreRoute("{resource}.axd/{*pathInfo}");***

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

    }

第一行我不清楚..谁能解释一下它的确切目的是什么?

4

1 回答 1

0

ASP.NET MVC 允许您使用它应该忽略的 URL 模式定义路由。在您的情况下,所有包含 .axd 的网址都将被忽略。没有 Controller 和 Action 将与 .axd 请求交互。您可以在此处找到有关 .axd 的更多详细信息 -什么是 .axd 文件?.

于 2013-10-03T17:03:51.430 回答