I am confused about httpHandlers in system.web
and handlers in system.webServer
. What is the difference between these two configuration? And how and when to use them?
Actually another question is for modules as well: httpModules in system.web
and modules in system.webServer
The system.webServer section in the Web.config file specifies settings for IIS 7.0 that are applied to the Web application. The system.WebServer is a child of the configuration section. For more information, see IIS 7.0: system.webServer Section Group (IIS Settings Schema).
and <system.web>
specifies the root element for the ASP.NET configuration section and contains configuration elements that configure ASP.NET Web applications and control how the applications behave. httpHandlers
& handlers
are same.
To register an HTTP handler for IIS 6.0 use should:
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="SampleHandler.new"
type="SampleHandler, SampleHandlerAssembly" />
</httpHandlers>
</system.web>
</configuration>
To register an HTTP handler for IIS 7.0 use should:
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="SampleHandler.new"
type="SampleHandler, SampleHandlerAssembly" />
</httpHandlers>
</system.web>
<system.webServer>
<add name=SampleHandler" verb="*" path="SampleHandler.new"
Modules="IsapiModule"
scriptProcessor="FrameworkPath\aspnet_isapi.dll"
resourceType="File" />
</system.webServer>
</configuration>
Read more Here
<system.web>
is the configuration section for asp.net, traditionally this is where you would define your httpHandlers and httpModules.
With the introduction of IIS 7 (2007) the web server and asp.net got much more integrated and a completely new IIS configuration system was introduced.
As part of this the location for handler and module definitions was moved to <system.webServer>
If you are still using IIS6 (stop it) or use classic pipeline mode in IIS7+ you need to have your definitions under <system.web>
, if you are using integrated pipeline mode in IIS7+ put them under <system.webServer>
. You should not have them in both sections.
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