2011-09-20 62 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");