Recent development involves some use of ihttpmodule and IHttpHandler, just reserve enough, grasp the query MSDN learn a bit, will learn a bit record.
I. IHttpModule
The code to view this interface can be found to consist of two methods:
public interface ihttpmodule{void Dispose (); void Init (HttpApplication context); }
Seeing two methods and method tags, you know what this IHttpModule interface does, and the Init method passes in a HttpApplication parameter that provides access to common methods, properties, and events for all application objects within the ASP.net application. Includes access to methods, properties, and events under HttpApplication. What about the specifics?
Including all the objects that we often use, application,context,event,modules,request,response,server,session,site,user,beginrequest, EndRequest and so on, there is a method in the context where context.rewritepath can be used to rewrite URLs, which means that as soon as you add a class that inherits the IHttpModule interface in the App_Code, After adding this module to Webconfig, the class can handle all the methods, properties, and events of the global application.
1. A test was done for commonly used operations:
The application will output the contents of this module to each requested page.
2. For URL rewrite tests are as follows:
Explains that when a user requests a page, the URL is rewritten if the request path does not include custom, but the test fails and is studying the use of the RewritePath method.
Ii. IHttpHandler
This interface consists of a method of a property
public interface ihttphandler{BOOL IsReusable {get;} void ProcessRequest (HttpContext context); }
IsReusable gets a value that indicates whether the System.Web.IHttpHandler instance can be used by other requests.
System.Web.HttpContext object that provides references to internal server objects (such as request, Response, session, and server) that are used to service HTTP requests.