routes.Add(new Route("Web_Cl/ApplicationCase_Content/{id}/{tid}", new RouteHandler("~/Web_Cl/ApplicationCase_Content.aspx")) { Constraints = new RouteValueDictionary { { "Page", @"\d" }, { "tid", @"\d" } } });加了约束之后为什么就能访问了求解为什么那,求帮忙啊!!!!
你2个问题是冲突的,不过一半都是加了约束之后访问不了.不会加了约束才能访问
routes.Add(new Route("news/category/{id}", new RouteHandler("~/NewFolder1/Default.aspx")));
routes.Add(new Route("news/{id}/{page}", new RouteHandler("~/NewFolder1/Default.aspx")) { Constraints = new RouteValueDictionary { { "Page", @"\d+" }, { "tid", @"\d+" } } });
routes.Add(new Route("news/{year}/{month}/{day}", new RouteHandler("~/NewFolder1/Default.aspx")));
routes.Add(new Route("search", new RouteHandler("~/NewFolder1/Default.aspx")));
这是我写的demo也是这样子啊你看是冲突的原因吗?
@MingHao_Hu: new RouteHandler("~/NewFolder1/Default.aspx")这个是什么东西?
我没用过这种模式
@吴瑞祥: 路由的routeHandler类处理路由的默认页面