When a user or client request for an ASPX page say http://localhost/WebApp/Default.aspx. The request is first received by the IIS i.e., inetinfo.exe. IIS can
resolve the page if it is a static file like HTML, since it is ASPX page it forwards the request to ISAPI filters which is aspnet_isapi.dll. It is the isapi filter that is used in handling ASP.Net
Request. The isapi filter forwards the request to the worker process which is aspnet_wp.exe. The worker process is the one who execute the request and give back the HTML output back to the
client.
HttpModules and HttpHandlers
The HttpModules and HttpHandler are the
components in worker process that helps in completing the request. There is a mechanism called Http Pipeline inside the worker process to complete the request. Http pipeline is nothing but it is a
mechanism that receives the request with relevant information’s (via HttpContext object) and passes the request to series of object. During this stage the involvement of HttpModules comes into the
picture for servicing the request. There are a number of system-level(asp.net) HTTP modules, providing services ranging from authentication to state management to output caching. We can always write our
own httpmodules and configure it for our web application in web.config. System-level HttpModules configuration resides in machine.config file. Open the Machine.config file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG and you can see the configuration of httpmodules that is involved by default in an asp.net request processing. I have installed framework in C:\ so
look into the drive where you installed the framework for machine.config file.
There may be more than one httpmodules involved in a request processing like authentication, caching, etc. After the request is
processed by httpmodules it is given to the HttpHandler for further completion. Like HttpModules there cannot be more than one HttpHandler that is involved in a request processing. To add more value to
the above point, in our example user requests an ASPX page so the HttpHandler which receives the request will be HttpPageHandlerFactory, it’s an factory implementation. Like HttpModules we can also
write a custom HttpHanlder and configure it Web.Config of our application to use it during request processing. As HttpModules the default HttpHandler used for ASP.Net request processing is configured in
Machine.Config file. Below you can find the information’s about HttpHandler in machine.config,
If you see above configuration settings you can understand why we can’t browse web.config, project file, .cs file as it is handled by System.Web.HttpForbiddenHandler handler which forbids the output from being viewed by the user
No comments:
Post a Comment