2

我的应用程序路由 url 是这样的:

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")));

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

谁能建议我如何做到这一点以及如何获得变量的值。

4

0 回答 0