确定 HttpModule 中当前 URL 的页面

发布于 2024-08-15 06:12:58 字数 505 浏览 6 评论 0原文

我怀疑答案是否定的(或者至少不是以明智的方式),但我想问。

是否可以在 asp.net HttpModule 中确定将返回给用户的页面,同时考虑 IIS 的默认页面设置(无需在 IIS 之外对它们进行硬编码)。例如,如果用户请求 http://www.example.org/bar/,真实页面可能是 http://www.example.org/bar/index.html -- 但也可以很容易地 http://www.example.org/bar/foot .html ,取决于用户的 IIS 设置。

I suspect the answer is no (or at least, not in an intelligent manner), but felt like asking.

Is it possible in an asp.net HttpModule to determine the page that is going to be returned to the user, taking default page settings of IIS into account (without hardcoding them outside of IIS). For example, if a user requests http://www.example.org/bar/, the real page might be http://www.example.org/bar/index.html -- but could just as easily be http://www.example.org/bar/foot.html , depending on the user's IIS settings.

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

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

发布评论

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

评论(1

毁我热情 2024-08-22 06:12:58

您是对的:如果请求的 URL 中没有可用的 file.ext,则 IIS 设置必须可用才能确定返回的实际页面。

鉴于该模块必须驻留在 IIS 服务器上,我认为您可以通过 WMI 连接来获取 IIS 中配置的默认页面列表。然后,您必须获取请求的文件夹中的文件列表,以确定实际返回了哪些默认页面。

You're correct: in cases where there was no file.ext available in the requested URL, the IIS settings would have to be available in order to determine the actual page that was returned.

Given that the module has to live on the IIS server, I think you could get the list of default pages configured in IIS by connecting via WMI. You'd then have to get the list of files in the requested folder to figure out which of the default pages was actually returned.

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