سؤال

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top