【发布时间】:2010-06-17 00:24:27
【问题描述】:
我正在尝试在 IIS6 服务器上运行的 asp.net 4.0 站点上配置路由。 我正在使用 MapPageRoute,它会将我带到正确的页面。目前遇到的问题:
1) 无扩展 URL 路由
通过安装此处描述的 QFE 解决了http://blogs.msdn.com/b/tmarq/archive/2010/04/01/asp-net-4-0-enables-routing-of-extensionless-urls-without-impacting-static-requests.aspx
2) js、css、图片等静态内容不显示
使用此处描述的 Chris Cavanagh 的 baseUrl 技术解决了 chriscavanagh.wordpress.com/2008/11/06/aspnet-routing-just-enough-rope/
2) 相对url和回发场景
未解决。由于某种原因,没有正确解释相对路径。例如。 asp:ImageButton runat="server" ImageUrl="~/images/tree.jpg" 使用 src="" 渲染为和 img。我已经能够通过将 ImageUrl 设置为绝对路径来强制它工作,但我不能对所有事情都这样做。它还影响回发方案。按钮点击将我从(例如)localhost/website/articles/the-article_description/ 带到不存在的 localhost/website/the-article-description。
谁能帮我解决这个问题?
【问题讨论】: