路由规则是冲突的

时间:2013-03-14 09:16:52

标签: c# asp.net routing

我的应用程序路由网址如下:

routes.Add("Rule1",
            new Route("test/12345/{subjectname}/{pageno}",
            new RouteValueDictionary { { "pageno", null } },
            new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
            new GlobalURLRouteHandler("~/test/test.aspx")));

   routes.Add("Rule2",
                new Route("questions/middle-east/{subjectname}/{pageno}",
                new RouteValueDictionary { { "pageno", null } },
                new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
                new GlobalURLRouteHandler("~/test/test.aspx")));

        routes.Add("Rule3",
               new Route("questions/universal-affairs/{subjectname}/{topicname}/{pageno}",
               new RouteValueDictionary { { "pageno", null } },
               new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
               new GlobalURLRouteHandler("~/test/test.aspx")));


        routes.Add("Rule4", new Route("questions/{subjectname}/recent-questions/{pageno}",
              new RouteValueDictionary { { "pageno", null } },
              new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
              new GlobalURLRouteHandler("~/test/test1.aspx")));

    routes.Add("Rule5", new Route("questions/{subjectname}/{topicname}/recent-questions/{pageno}",
              new RouteValueDictionary { { "pageno", null } },
              new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
              new GlobalURLRouteHandler("~/test/test2.aspx")));

    routes.Add("Rule6", new Route("questions/{subjectname}/{topicname}/{subtopicname}/recent-questions/{pageno}",
                   new RouteValueDictionary { { "pageno", null } },
                   new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
        new GlobalURLRouteHandler("~/test/test3.aspx")));


    routes.Add("Rule7", new Route("questions/{subjectname}/recent-questions/{pageno}",
                   new RouteValueDictionary { { "pageno", null } },
                   new RouteValueDictionary { { "pageno", @"^[0-9]*$" } },
        new GlobalURLRouteHandler("~/test/test3.aspx")));

这些是我现有的网址,现在我想在这些网址中替换 / with - ,当我这样做时,我的网址会有冲突。

任何人都可以建议我如何做到这一点以及如何获得变量值。

0 个答案:

没有答案