views:

302

answers:

2

I know that this has already been asked here but the answer (using a handler instead) doesn't solve the issue, as I'm using a third party component that doesn't implement IHttpHandler.

So, again, is there any way to load/unload a HttpModule on a certain request?

EDIT: I forgot to mention that we're working with .NET 2.0. I'm sorry about forgeting it.

+1  A: 

I haven't tested this, but a comment in this article seems to suggest that it is possible to register modules only for certain locations by using a <location> element in web.config, e.g:

  <location path="some/path">
    <system.web>
      <httpModules>
        <remove name="name"/>
        <add name="name" type="type"/>
      </httpModules>
    </system.web>
  </location>
M4N
We tried this already, but for some reason, it's not working for us :(
MaLKaV_eS
I'll mark this as the answer, until I come up with a better solution for our particular problem, as seems that it isn't working because an extrange reason.
MaLKaV_eS
A: 

I assume that the problem is with the inheritance of the HttpModule, do you need the inheritance of your web.config with the third party control?

Try adding this attribute where the path will be where you component is stored;

<location path="/ThirdPartyComponents" inheritInChildApplications="false">
    ...
</location>
Dave Anderson
Did not work, either. We'll keep trying (and will ask third party support...)
MaLKaV_eS
I normally just use a period in the path to disable inheritance globally for all sub folders. I only added a path here as I assume you need inheritance outside of your third party components.
Dave Anderson