IAsyncResult and IcallbackEventHandler in dealing long running process

Lets face it! Whether you use Ajax or you don’t in case of a long running process the browser often shows a “Time Out Error”, while leaving you restless.
Incase of ASP.NET AJAX if you use a script manager then also you will be prompted to define the time out for the request and in most cases it is impossible to predict as we hardly know how long the process will take to execute.
A solution was much needed and now a days AJAX is being largely used to handle long running process coupled with the IAsyncResult and IcallbackEventHandler.
It is just the client server architecture, which defines the web application methods. Quite naturally therefore whenever the client hits the server, the server replies. However, in case of a long running process a particular mechanism is needed to determine the time when the long process will be over! To take care of this issue now a day using IAsyncResult is indeed common. Using this interface it is pretty simpler to run asyncronous processes on the server side, while invoking one method on server side without hindering the continuity of the other tasks.
When the first method is completed, then it automatically calls another server method while letting you update some parameters according to your likings.  While IAsyncResult ensures the successful running of the asyncronous processes, the Icallback Handler can be adequately used to check for the parameters like VARI and VAR2 as soon as the updated values are generated, thus changing the status of long running method on client.
This further takes care of the LongRunningMethod registration for the delegate while invoking the LongRunningMethod.

Now when you try to invoke the LongRunningMethod try to register the AsyncCallback method for further accuracy and effectiveness in dealing the long running process in ASP.NET.

Leave a Reply

Your email address will not be published. Required fields are marked *



Recent Blogs