I have the following code in a web.config file of the default IIS site.
I've found the answer. Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false.
Now any virtual directories will not inherit the settings in this location section.
@GateKiller This isn't another website, its a virtual directory so inheritance does occur.
@petrich I've had hit and miss results using
. I have to remember to add it to every virtual directory which is a pain.