Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 从HttpContext获取Web.Config中注册的HttpHandler_Asp.net - Fatal编程技术网

Asp.net 从HttpContext获取Web.Config中注册的HttpHandler

Asp.net 从HttpContext获取Web.Config中注册的HttpHandler,asp.net,Asp.net,有没有办法从当前的HttpContext或web.config获取注册的IHttpHandlers的类型 我正在尝试查看我的HttpHandler是否已从WebControl在web.config中注册。您可以通过以下方式从web.config获取已注册的HttpHandler列表: using System.Configuration; using System.Web.Configuration; Configuration cfg = WebConfigurationManager.Op

有没有办法从当前的
HttpContext
或web.config获取注册的
IHttpHandler
s的类型


我正在尝试查看我的
HttpHandler
是否已从
WebControl

在web.config中注册。您可以通过以下方式从web.config获取已注册的
HttpHandler
列表:

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

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

这实际上不适用于自定义处理程序。运行上面的代码可以得到所有的股票处理程序,但是我的自定义处理程序没有显示在处理程序列表中。此外,您还需要检查(system.webServer/handlers),这取决于应用程序是在IIS 7上运行还是在以前的版本上运行。为了澄清Rick的意思,这不适用于IIS 7。但是,我可以确认这对IIS 6有效。