In ASP.NET is there any way to programatically resolve the path to a loaded HttpHandler as it is defined in the Web.config? (i.e. SomeModule.axd)?
From the current http context use the path property of the Request object
If I understand the question correctly, you want to fetch the path from web.config right?
If so, what you are probably looking for is something like this:
string p = null;
System.Web.Configuration.HttpHandlersSection httpHandlersSection =
(System.Web.Configuration.HttpHandlersSection)
System.Configuration.ConfigurationManager.GetSection("system.web/httpHandlers");
foreach (System.Web.Configuration.HttpHandlerAction handler in httpHandlersSection.Handlers)
{
if(handler.Type == "myType")
{
p = handler.Path;
break;
}
}
The trick here is the if statement. Handlers in web.config don't have friendly "names" you can use as a key. All they have are types (which can be ugly strings), paths, and the verb. To locate the specific handler you are interested in you might have to search within the handler's type or path for a known substring that identifies the specific handler you are interested in finding.
If you're interested in the path to the handler processing the current request:
string path = HttpContext.Current.Handler.GetType().Assembly.CodeBase;
If you happened to know where to find a collection of the other handler instances, you could use the same approach to get their paths as well.