确定 HttpModule 中当前 URL 的页面
我怀疑答案是否定的(或者至少不是以明智的方式),但我想问。
是否可以在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是对的:如果请求的 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.