3

I am attempting to use an HttpModule to intercept requests to a specific directory which contains none code files (Images, Music, etc). The Module I have works except it applies to all folders not just the one I want it to apply to. I attempted to use the following code in my web.config to force it to the one location only, but it doesn't seem to work:

<location path="extraData/files">
  <system.webServer>
    <modules>
      <remove name="staticFileSecurityModule"/>
      <add name="staticFileSecurityModule" type="content.httpModules.StaticFileSecurityModule" preCondition=""/>
    </modules>
  </system.webServer>
</location>

The directory I want this module to be used for is /extraData/files

2 Answers2

0

Can't you build it in to the module to check the current Url from the HttpRequest object, and then if it's in the same URL, do something with it? That could also be made configurable using a custom configuration section.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257
0

Haven't tried it, but how about creating a new Web.config in your specific directory, and placing this code only in this Web.config?

Oleg Grishko
  • 4,132
  • 2
  • 38
  • 52