火灾事件请求静态内容不runAllManagedModulesForAllRequests设置为true [英] Fire events for requests to static content without setting runAllManagedModulesForAllRequests to true

查看:511
本文介绍了火灾事件请求静态内容不runAllManagedModulesForAllRequests设置为true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个更precise解决方案来处理由ASP.NET生命周期中的静态内容的请求,而不 runAllManagedModulesForAllRequests 设置为true。
据我所知道的是 runAllManagedModulesForAllRequests =真正的的每个模块的precondition属性将被设置为,<效果/ code>。

I'm looking for a more precise solution to handle requests for static contents by the ASP.NET lifecycle without setting runAllManagedModulesForAllRequests to true. As far as I know is the effect of runAllManagedModulesForAllRequests = "true" that the precondition attribute of each module will be set to "".


  • 我要保护静态内容免遭未授权访问一个Web应用程序
  • 的子文件夹
  • 要包含在ASP.NET生命周期要求的那些静态的内容,因此有,我设置 runAllManagedModulesForAllRequests 真正在web.config中。

  • 因为这个溶液变成大轮和所有管理模块都影响了整个应用程序,我正在寻找仅限于那些需要这种行为的子文件夹更适合的解决方案。

  • 我需要IIS6和II7
  • 解决方案
  • I have to protect static content in a subfolder of a web application against unauthorized access
  • To include requests to those static contents in the ASP.NET lifecycle and therefore having some events fired, I set runAllManagedModulesForAllRequests to true in web.config.
  • Because this solution turns the big wheel and all managed modules are affected for the whole application, I'm looking for a more adapted solution restricted to the subfolder where this behavior is required.
  • I need a solution for IIS6 and II7

的哪些模块必须被重置了的preconditon( precondition =)解雇的global.asax.cs事件(如的Application_BeginRequest )的静态内容的请求?

The preconditon of which modules have to be resetted (precondition = "") to fire global.asax.cs events (e.g. Application_BeginRequest) for requests for static contents?

是否有可能限制这种请求(放置一个适应的web.config在该子文件夹,tweeking主要web.config中,例如......也许)处理请求到一个子文件夹

Is it possible to limit this request handling to requests to a single subfolder (e.g. perhaps by placing an adapted web.config in this subfolder, tweeking the main web.config, ...)

任何建议将是AP preciated。谢谢你。

Any suggestions would be appreciated. Thanks.

推荐答案

你有没有在注册自定义的HttpModule为Global.asax中的权事件,然后启用HTTP模块只使用子目录<$的方向想C $ C>位置的web.config 本身?这仅仅是一个可能的解决方案的想法 - 我通过它还没有想到。

Have you thought in the direction of registering a custom HttpModule for the right event of global.asax, and then enabling the HttpModule only for the sub directory using location attribute in the main web.config itself? It is just a thought of a possible solution - I havent thought through it..

<location path="subDirectoryPath">
   <system.web>
     <httpmodules>
        <add type="MyCustomModule.Name" name="MyCustomModule" />      
     </httpmodules>
   </system.web>
</location>

编辑:

您可能要重写你的web.config,而在这一切的HTTP模块部分带来,然后在合适的位置插入自定义模块,用正确的precondition。
这是为了避免设置 runAllManagedModulesForAllRequests

You may have to override your web.config, and bring in all the httpModule section in this, and then insert the custom module at the right place, with the right precondition. This is to avoid setting runAllManagedModulesForAllRequests to true

这篇关于火灾事件请求静态内容不runAllManagedModulesForAllRequests设置为true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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