从IIS7上的静态内容运行排除HTTP模块 [英] Exclude HttpModule from running for static content on IIS7

查看:94
本文介绍了从IIS7上的静态内容运行排除HTTP模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a problem with my Authentication HttpModule.问题是,它显然会运行每一个请求,我得到我的Web服务器(IIS7)上。因为它也使用Session变量,它不能对CSS,JS文件和类似的正常工作。

I have a problem with my Authentication HttpModule. The problem is that it obviously runs for every single request I get on my web server (IIS7). Because it also uses Session variable, it fails to work properly on CSS, JS files and similar.

我试图用

<add name="AuthModuleName" type="..." preCondition="managedHandler" />

但无济于事。它仍然在每次请求运行无论其扩展名或MIME类型。我还要补充,有一个设置

but to no avail. It still runs on every request regardless of its extension or mime type. I should also add, there's a setting

<modules runAllManagedModulesForAllRequests="true">

这似乎怀疑我,其实残疾人preConditions模块。但将其更改为假,打破了完全不同的方式和不同的异常应用程序(SessionStateTempDataProvider需要SessionState会启用)。

that seemed suspicious to me and actually disabled preConditions on modules. But changing it to false, breaks the application in a completely different way and with a different exception (The SessionStateTempDataProvider requires SessionState to be enabled).

任何人可以帮助我如何强制IIS7排除我的HttpModule当请求静态内容的文件进行?

Can anybody help me how to force IIS7 to exclude my HttpModule when requests are made for static content files?

推荐答案

runAllManagedModulesForAllRequests 属性的拥有被设置为以实际配置任何模块,您想要的方式。你将不得不还正确重新配置会话和其他需要,更主要的是,处理请求处理管道执行顺序。

runAllManagedModulesForAllRequests attribute has to be set to false to actually configure any module the way you want. You will have to also correctly reconfigure Session and others as needed, but the main thing is handlers pipeline execution order that handles requests.

答案在我的其他问题之一:

感谢彼得说,只要工作正常了答案。

Thanks to Peter that provided the answer that worked correctly.

这篇关于从IIS7上的静态内容运行排除HTTP模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆