Use custom thread asynchronous processor
To create a real asynchronous handler, you must manually generate additional threads in the BeginProcessRequest response. Successfully created asynchronous handlers have three important features. One constructs a class that supports the IASYNCRESULT returns from BeginProcessRequest. Second, generate a thread execution Your request is processed asynchronous. III. Notification ASP.NET You have ended the processing request and ready to return response
I will build an asynchronous handler by constructing an IASYNCRESULT class. This class will return from calling beginprocessRequest, then I will implement EndProcessRequest, in another thing, save a state of the specified request is useful, I need to use this request request In order to complete the IASYNCRESULT interface, the implementation is as follows:
Public Interface IasyncResult
{
Public Object asyncState {get;}
Public Bool CompletedSynchronously {get;}
Public Bool IScompleted {Get;}
Public Waithandle AsyncWaithandle {Get;}
}
Other implementations, please see the code about the flowchart, see the following two figures: