开发者

Differentiate static file and asp.net pages in httpmodule - IIS7

开发者 https://www.devze.com 2023-03-07 11:15 出处:网络
In IIS7 integrated mode, especially in ASP.NET MVC and .NET4, all modules run for all request. runAllManagedModulesForAllRequests=\"true\". making runAllManagedModulesForAllRequests=\"false\" give me

In IIS7 integrated mode, especially in ASP.NET MVC and .NET4, all modules run for all request. runAllManagedModulesForAllRequests="true". making runAllManagedModulesForAllRequests="false" give me headace and too many issue about this until I get confused.

So to make it simple, just let my module accept all request including static file but in the module like BeginRequest, I want to handle only开发者_高级运维 if it is not static file. How to filter or check this condition in module?


This doesn't exactly answer your question, but since nobody else has answered, I have what could possibly be part of the solution.

If you split your module into two, one for managed handler requests, and one for everything else, then in your web.config, where you add your "managed handler request" module, you can add the attribute preCondition="managedHandler". So it would look like this:

    <system.webServer>
      <modules>
        <add name="DynamicRequestModule" type="..." preCondition="managedHandler" />
        <add name="StaticRequestModule" type="..." />

Given this configuration, the "DynamicRequestModule" module will execute only when the request is for a resource that has a managed handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号