How can you see the collection of registered httphandlers?
How can you see which HttpHandlers are registered? How can you loop thr开发者_JAVA技巧ough the registered HttpHandlers? I suppose all the handlers are in a collection somewhere but where.
using System.Configuration;
using System.Web.Configuration;
Configuration cfg = WebConfigurationManager.OpenWebConfiguration("/");
HttpHandlersSection hdlrs = (HttpHandlersSection)cfg.GetSection("system.web/httpHandlers");
just copied from here: Get Registered HttpHandlers in the Web.Config from HttpContext
From a web application, you can get the section with one line using the ConfigurationManager.
HttpHandlersSection httpHandlers = (HttpHandlersSection)ConfigurationManager.GetSection("system.web/httpHandlers");
精彩评论