In ASP.NET to process requests a pipeline model is used which consists of HTTPModules and HTTPHnadler objects. This pipeline model forms the low level framework which is used by web pages and web services. Here we will see a high level overview of asp.net request processing.
When we request a URL from a Web browser, the request is sent to the web server. The web server maps the file extensions with the dll’s that will handle the request called as ISAPI extension mappings. We can also configure the mappings in IIS.
For ASP.NET pages the extension is aspx. So when request for an ASP.NET page comes to the web server, the web server passes the request to the asp.net dll which passes the request to the worker process.The following diagram illustrates the process. This diagram is based on the IIS 5 processing model.
Once the request reaches the worker process it is processed by the pipeline which runs within asp.net worker process. The httpRequest is received by an instance of HTTPRuntime class which creates an instance of HTTPApplication class to process the request.
HTTPApplication class contains number of HTTPModules to which request and response are passed on its way to the HTTPHandler.
HTTPModules are filters that can examine and modify the contents of request and response.
The end of the pipeline is HTTPHandler which is an object of the class that implements IHTTPHandler interface.Asp.net page and web services are examples of HTTPHandlers.
We can create our own HTTPHandlers by following the following steps
- Implementing the IHTTPHandler
- Copying the compiled dlls to the bin directory of the application
- Registering the handlers in the web.config.
We can register the HTTPHandlers in the web.config file by using the following web.config file element.
<add verb=”*” path=”*.Test ”
type=”ClassName, AssemblyName” />
Above verb is the method used Get Or Post .Type is the className and assembly name and path is the URL .