如何使用 IIS6 让 HttpModule 为 *所有* 文件扩展名触发
我已经对这个问题进行了足够的研究,推测这只能使用通配符映射到“aspnet_isapi.dll”来实现。我还了解到这也不推荐,但我没有找到其他方法来获取任何扩展的 HttpModule。
我不能简单地这样做的原因是“.asp”扩展名出现问题。当尝试访问 ASP 文件时,我收到一条“未提供此类型的页面”消息,即使 ASP 文件只有纯 HTML,或者根本没有内容。
有没有办法告诉.NET不要尝试处理asp文件的内容,而只启动HttpModule?
也许我什至在这里走错了路...我只想在向某个目录发出 HTTP 请求时执行一段 .NET 代码,无论文件扩展名如何,然后正常处理该请求。
有人有什么想法吗?
I've learned enough researching this problem to surmise that this is only possible using a wildcard mapping to "aspnet_isapi.dll". I've also read that this is also not recommended, but I've found no other way to get the HttpModule for any extension.
The reason I can't simply do it this way is that trouble occurs for the ".asp" extension. I get a "This type of page is not served" message when trying to access ASP files, even if the ASP file only has plain HTML, or has no content at all.
Is there a way to tell .NET to not try to process the content of asp files, and only launch the HttpModule?
Maybe I'm even going down the wrong route here...I just want a block of .NET code to execute anytime a HTTP request is made to a certain directory, regardless of file extension, and then handle the request normally.
Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来像是 MIME 类型问题吗?
http://support.microsoft.com/kb/326965
要为特定扩展定义 MIME 类型,请按照下列步骤操作:
单击新建。
Could sound like a MIME type issue?
http://support.microsoft.com/kb/326965
To define a MIME type for a specific extension, follow these steps:
Click New.