Is there a way to get the types of the registered IHttpHandler
s from a current HttpContext
or the web.config?
I'm trying to see if my HttpHandler
is registered in the web.config from a WebControl
.
config file, create a handlers element in the system. webServer section. Handlers that are defined in the httpHandlers element are not used. If you do not remove the httpHandlers registrations, you must set the validation element's validateIntegratedModeConfiguration attribute to false in order to avoid errors.
To create a custom HTTP handler, you create a class that implements the IHttpHandler interface to create a synchronous handler. Alternatively, you can implement IHttpAsyncHandler to create an asynchronous handler. Both handler interfaces require that you implement the IsReusable property and the ProcessRequest method.
- An HTTP handler is the process, also called the endpoint, that runs in response to a request. It's used to handle specific requests based on file extensions and verbs. You can leverage these handlers to inject processing logic into the request pipeline.
The configuration element registers the custom handler factory by class name and maps the . sample file name extension to that handler. Because you are registering a custom file name extension, you register the handler in both the handlers section and the httpHandlers section.
You can get the list of registered HttpHandler
s from web.config this way:
using System.Configuration;
using System.Web.Configuration;
Configuration cfg = WebConfigurationManager.OpenWebConfiguration("/");
HttpHandlersSection hdlrs = (HttpHandlersSection)cfg.GetSection("system.web/httpHandlers");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With