views:

215

answers:

2

Consider an HttpHandler that can be configured for multiple paths. But based on the path that matched a url i could be able to select the settings to apply.

I don't want to pass parameters in the url.

+1  A: 

I don't have time right now to write a complete example, but I guess this would be the way to go:

  • Read Web.config;
  • Get locations;
  • Loop through locations;
  • If location uri matches the current uri (get it from System.Web.HttpContext.Current), then you have the current path;
  • Use the current path to retrieve settings from wherever you stored them.

Good luck.

A: 

Thanks. I have done that and it works well. I also made use of the reflector tool to see how the handler mapping match is made. There seems to be another challenge i have come across. There different ways to configure httphandlers depending on the type of application pool. Is there a general way to get configuration data of the current pool httphandlers?