私のアプリケーションのルーティング 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")));
これらは私の既存の URL です。/ を -に置き換えたいと思います。これらの URL では、これを行ったときに URL が競合しています。
これを行う方法と変数の値を取得する方法を教えてください。