2011-09-20 60 views
5

你怎么看到哪个HttpHandlers被注册了? 如何循环注册的HttpHandlers?我想所有的处理程序都在某个集合中,但在哪里。你如何看到注册的订阅者的集合?

+0

可以扩展一下吗?你想要处理什么?在你的'Web.Config'的'httpHandlers'部分中定义了httphandlers就是你在做什么? –

+0

这是相同的问题http://stackoverflow.com/questions/7083911/get-registered-httphandlers-in-the-web-config-from-httpcontext? –

回答

0
using System.Configuration; 
using System.Web.Configuration; 

Configuration cfg = WebConfigurationManager.OpenWebConfiguration("/"); 
HttpHandlersSection hdlrs = (HttpHandlersSection)cfg.GetSection("system.web/httpHandlers"); 

从这里只是复制:Get Registered HttpHandlers in the Web.Config from HttpContext

0

从Web应用程序,你可以得到部分使用ConfigurationManager中一行。

HttpHandlersSection httpHandlers = (HttpHandlersSection)ConfigurationManager.GetSection("system.web/httpHandlers");