ASP.NET MVC 2 和自定义 httpModule 优先级

发布于 2024-08-08 23:00:16 字数 297 浏览 2 评论 0原文

形式的 url 映射

我在现有的 Web 应用程序项目中有一个自定义 HttpModule 重写引擎,它将/tom/dick/harry/.../.../...

到存储在数据库中的分层导航系统,最终导致对请求路径解析到的 .aspx 页面的 HttpContext.Current.RewritePath() 调用。

我对将 MVC 与现有应用程序混合感兴趣。如果 MVC 代码运行良好并且比代码隐藏模型提供真正的好处,那么我将如何处理重写引擎和路由表之间的优先级?路由表是在 HttpModule 之前还是之后引用的?两个都叫吗?

I have a custom HttpModule rewrite engine in an existing web application project that maps urls of the form

/tom/dick/harry/.../.../...

to a hierarchical navigation system stored in a database, ultimately resulting in a HttpContext.Current.RewritePath() call to the .aspx page that the requested path resolves to.

I'm interested in mixing MVC in with the existing app. If the MVC code works well and provides real benefit over the code behind model, how will I handle precedence between my rewrite engine and the routetable? Is the routetable referenced before the HttpModule, after? Are both called?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉生梦死 2024-08-15 23:00:16

ASP.NET MVC 中的路由是作为自定义 HttpModule 实现的 (UrlRoutingModule),因此优先级取决于您的模块在 web.config 中声明的顺序

The routing in ASP.NET MVC is implemented as a custom HttpModule (UrlRoutingModule), so which takes precedence will depend on the order your modules are declared in web.config

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文