1

我仍然在努力阅读 global.asax 上的路由......我可以看到 URL 是

漏斗网/管理员/登录

路线是:

        // Due to a bug in the .AddServiceRoute<>() method in WCF we have to do this work around.
        // see http://wcf.codeplex.com/workitem/9 for bug description
        // Workaround caches all service route urls, removes the service routes. Adds a constraint to the wiki page route
        // then re-adds the service routes at the end.
        var serviceRoutes = routes
            .OfType<ServiceRoute>()
            .ToList();
        var serviceRoutesUrls = serviceRoutes
            .Select(serviceRoute => serviceRoute.Url.Replace("{*pathInfo}", ""))
            .ToArray();
        var notAService = new NotFromValuesListConstraint(serviceRoutesUrls.ToArray());
        var defaultConstraint = new { page = notAService };
        foreach (var serviceRoute in serviceRoutes)
        {
            routes.Remove(serviceRoute);
        }

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{*allaxd}", new { allaxd = @".*\.axd(/.*)?" });
        routes.IgnoreRoute("pingback");

        if (builder != null)
            AreaRegistration.RegisterAllAreas();

        // Feeds
        routes.MapLowerCaseRoute("feed", new { controller = "Feed", action = "Feed", feedName = (string)null });
        routes.MapLowerCaseRoute("feeds/{*feedName}", new { controller = "Feed", action = "Feed" });
        routes.MapLowerCaseRoute("commentfeed", new { controller = "Feed", action = "CommentFeed" });

        // Upload
        routes.MapLowerCaseRoute("get/{*path}", new { controller = "Upload", action = "Render", area = "Admin" });


        // Resources
        routes.MapLowerCaseRoute("robots", new { controller = "Resource", action = "Render", fileName = "/Content/Resources/Robots.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("robots.txt", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Robots.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("humans.txt", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Humans.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("humans", new { controller = "Resource", action = "Render", fileName = "Content/Resources/Humans.txt", contentType = "text/plain" });
        routes.MapLowerCaseRoute("favicon", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.ico", fileName2 = "/Content/Resources/favicon.ico", contentType = "image/vnd.microsoft.icon" });
        routes.MapLowerCaseRoute("favicon.ico", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.ico", fileName2 = "/Content/Resources/favicon.ico", contentType = "image/vnd.microsoft.icon" });
        routes.MapLowerCaseRoute("favicon.png", new { controller = "Resource", action = "Render", fileName = "{Theme}/Content/Images/favicon.png", fileName2 = "/Content/Resources/favicon.png", contentType = "image/png" });
        routes.MapLowerCaseRoute("status", new { controller = "Resource", action = "Render", fileName = "/Content/Resources/Status.html", contentType = "text/html" });

        // Site Map
        routes.MapLowerCaseRoute("sitemap", new { controller = "Wiki", action = "SiteMap" });
        routes.MapLowerCaseRoute("sitemap.xml", new { controller = "Wiki", action = "SiteMap" });

        // Tags
        routes.MapLowerCaseRoute("tag/{*tagName}", new { controller = "Tag", action = "Index" });

        // Tagged Pages
        routes.MapLowerCaseRoute("tagged/{*tag}", new {controller = "Tagged", action = "Index"});

        // Wiki
        routes.MapLowerCaseRoute("blog", new { controller = "Wiki", action = "Recent", pageNumber = "0" });
        routes.MapLowerCaseRoute("blog/{pageNumber}", new { controller = "Wiki", action = "Recent" }, new { pageNumber = "\\d+" });
        routes.MapLowerCaseRoute("", new { controller = "Wiki", action = "Home", pageNumber = "0" });
        routes.MapLowerCaseRoute("{pageNumber}", new { controller = "Wiki", action = "Home" }, new { pageNumber = "\\d+" });
        routes.MapLowerCaseRoute("search", new { controller = "Wiki", action = "Search" });

        routes.MapLowerCaseRoute("unpublished", new { controller = "WikiAdmin", Area = "Admin", action = "Unpublished" });
        routes.MapLowerCaseRoute("admin/new", new { controller = "WikiAdmin", Area = "Admin", action = "Edit", page = "" });
        routes.MapLowerCaseRoute("edit/{*page}", new { controller = "WikiAdmin", Area = "Admin", action = "Edit", page = UrlParameter.Optional });
        routes.MapLowerCaseRoute("revert/{*page}", new { controller = "WikiAdmin", Area = "Admin", action = "Revert" });

        routes.MapLowerCaseRoute("via-feed/{*page}", new { controller = "Resource", action = "Render", fileName = "/Content/Images/Transparent.gif", contentType = "image/gif" });
        routes.MapLowerCaseRoute("history-of/{*page}", new { controller = "Wiki", action = "Revisions" });
        routes.MapLowerCaseRoute("trackbacks-for/{*page}", new { controller = "Wiki", action = "Pingbacks" });

        // Remove .aspx
        routes.Add(new RedirectRoute("(?<page>[a-zA-Z0-9/\\-\\._\\+ ]+)\\.aspx", new MvcRouteHandler()) { ReplacePattern = "/$1" });
        routes.Add(new RedirectRoute("(?<page>rss)$", new MvcRouteHandler()) { ReplacePattern = "feed", ResponseCode = 302});

        routes.MapLowerCaseRoute("{*page}", new { controller = "Wiki", action = "Page" }, defaultConstraint);

        foreach (var serviceRoute in serviceRoutes)
        {
            routes.Add(serviceRoute);
        }

只是看不出我打算如何解决它的去向。因为似乎没有什么匹配 /admin/login...?

4

2 回答 2

1

也许你有一个注册路线的区域。另外,你试过一瞥吗?Glimpse 将向您展示使用了哪些路线。 http://getglimpse.com/

于 2011-11-06T17:57:36.467 回答
0

刚刚也尝试了 FunnelWeb 博客,我发现管理员/登录的路由在

\FunnelWeb\src\FunnelWeb.Web\Areas\Admin\RouteConfig.cs

context.MapRoute(
                "Admin_Login",
                "admin/login/{action}",
                new { controller = "Login", action = "Login" }
                );
于 2013-04-01T06:06:54.747 回答