views:

58

answers:

3

I have an application that depends on a generic HttpHandler I created, and it works fine. The problem is that that there are many other applications under the same folder in IIS, and these other apps don't need to use and don't know (mustn't know) about this handler. However, the Web.Config in which I register it ends up applying to all folders on the same level and all subfolders, and this is what I want to avoid.

Changing the structure of the apps inside IIS is not a possibility, unfortunately.

I thought of using the < location > tag on Web.config, but I'm under the impression it only changes rights to access and not visibility.

Any suggestions on how this can be overcome?

A: 

I think you need to look at Configuration Inheritance, and ways around it for child apps. Maybe start here:

http://msdn.microsoft.com/en-us/library/ms178685.aspx

http://www.aspdotnetfaq.com/Faq/how-to-disable-web-config-inheritance-for-child-applications-in-subfolders-in-asp-net.aspx

TimS
Do you know whether an HttpHandler would work on a Web.Config file on any hierarchical level?
jehuty
+1  A: 

You can apply a custom filter to your HttpHandler by checking the file that is going to pass by your filter, and keep only the one you need.

You can get the file name that is going to pass your HttpHandler by

HttpContext.Current.Request.Path

In this file name you can check for anything, for a directory, for a file, for what ever.

Hope that this help.

Aristos
A: 

HttpHandlers are configured at the application level. Are these subfolders you speak of really separate applications? If not, there's not much you can do about it... Aristos' suggestion might be viable though. If they are really applications, you'll just have to specifically remove the handler from those applications.

http://msdn.microsoft.com/en-us/library/e0dzxdza%28VS.71%29.aspx

Bryan
Yes, unfortunately, they really are different, unrelated and terribly out of context, applications. But it really is unegotiable.
jehuty