使用 ASP.NET 波形符 (~) 维护 ISAPI 重写路径

发布于 2024-09-05 06:19:23 字数 942 浏览 2 评论 0原文

我的团队正在从 ASP.NET 3.5 升级到 ASP.NET 4.0。我们当前正在使用 Helicon ISAPI Rewrite 将 http://localhost//default.aspx 映射到 http://localhost//default .aspx?AccountName= 其中 是查询字符串变量, 是虚拟目录(自然)。

升级之前,波浪号 (~) 解析为 http://localhost//... (我希望它这样做),升级之后,波浪号解析为 < code>http://localhost//... 这会导致错误,因为 查询字符串是必需的。

我想避免走上用相对路径替换所有内容的道路,因为我们系统中有几个功能使用整个 URL 而不仅仅是相对路径。

就其价值而言,我在 Windows 7 中使用 IIS7、带有 ASP.NET 4.0 的 Visual Studio 2010 和 64 位 Helicon ISAPI Rewrite。如果我切换回 ASP.NET 3.5 版本,那么它仍然可以正常工作(让我相信 IIS 中没有任何更改,除非它位于 4.0 应用程序池中 - 当我在 3.5 和 4.0 之间来回切换时,我必须更改应用程序池在 IIS 中)。

有什么想法吗?提前致谢!

My team is upgrading from ASP.NET 3.5 to ASP.NET 4.0. We are currently using Helicon ISAPI Rewrite to map http://localhost/<account-name>/default.aspx to http://localhost/<virtual-directory>/default.aspx?AccountName=<account-name> where <account-name> is a query string variable and <virtual-directory> is a virtual directory (naturally).

Before the upgrade the tilde (~) resolved to http://localhost/<account-name>/... (which I want it to do) and after the upgrade the tilde resolves to http://localhost/<virtual-directory>/... which results in an error because the <account-name> query string is required.

I'd like to avoid going down the road of replacing everything with relative paths because there are several features in our system that use the entire URL instead of just the relative path.

For what it's worth I'm using IIS7 in Windows 7, Visual Studio 2010 with ASP.NET 4.0 and the 64 bit Helicon ISAPI Rewrite. If I switch back to the ASP.NET 3.5 version then it still works fine (leading me to believe nothing changed in IIS unless it's within the 4.0 app pool - when I switch back and forth between 3.5 and 4.0 I have to change the app pool in IIS).

Any ideas? Thanks in advance!

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

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

发布评论

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

评论(1

ˉ厌 2024-09-12 06:19:23

IIS 7 具有良好的 http 重定向支持。因此您可能不再需要使用 ISAPI 过滤器

http: //technet.microsoft.com/en-us/library/cc732969(WS.10).aspx

使用 ISAPI 的另一种方法是使用 HTTP 模块重定向。

http://weblogs.asp.net/fmarguerie/archive/ 2004/11/18/265719.aspx

IIS 7 has a decent http redirect support. so you may not need to use that ISAPI filter anymore

http://technet.microsoft.com/en-us/library/cc732969(WS.10).aspx

another way around using ISAPI would be to use HTTP Module redirect.

http://weblogs.asp.net/fmarguerie/archive/2004/11/18/265719.aspx

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