【发布时间】:2010-03-10 04:17:57
【问题描述】:
我正在尝试切换现有的 WebForms 应用程序以使用路由,并希望分阶段进行。但是,我在特定路线上遇到了一些问题:
//I want to catch existing calls to .aspx pages, but force them through
// a route, so I can eventually drop the .aspx extension
new Route("{page}.aspx", new MyCustomRoute());
这根本不起作用,因为对 [SomePage].aspx 的调用永远不会绊倒这条路线...如果我将路线更改为如下所示:
//Same thing sans .aspx extension
new Route("{page}", new MyCustomRoute());
对 [SomePage] 的所有呼叫都将被接听。有什么想法吗?
【问题讨论】:
-
你的 MyCustomRoute 类是什么样的?
-
@mark123 - 感谢您的关注,但我想我明白了。我以前没有看过那个属性,我觉得有点愚蠢。我有点惊讶,但是 MSDN 文档并没有在其“WebForms 路由”示例的顶部用粗体字告诉您这一点......