ASPNET
ASP.NET AJAX is usually used to build complicated web applications. One of the challenges in building web applications using ASP.NET AJAX is the possibility of using very long process. We can always go ahead with that process however; the results are usually not good. Whenever a long process is used, the client side’s ability to read the process will take time and would probably lag the process. In the end instead of building a good web application, the client side will not be able to read the program and will render everything else useless.
But there is always the necessity of building this type of application. More than ever, our processes are usually complicated and will definitely require long process codes. We can’t just walk away and build smaller applications. There are small tricks that we could do to ensure that the long process could still be used while maintain the client side’s ability to read the process.
To be able to achieve this simple feat, coding have to work in both ways. The client and the server side should have their own set of commands to be able to understand the code.
For example you have a code for more than 6000 lines. You’ll definitely have some problem running this code properly in a server.
Instead of letting the version go through, we have to delegate the process. Think of it as slicing the pie but you do not actually remove it from the plate. The program will still be able to acknowledge the code but instead of slowing down while reading the code, it will read it in shorter terms. So instead of a lag, developers will now be able to execute the long process.
Use this code in each function: delegate void LongRun ();
You’ll notice that LongRun was voided. Remember to ensure that the program acknowledges the process as a LongRun or else it will read it as a normal code and again, lag the program.
After delegation, each part should now be activated to work. As Ajax is always Asynchrononous it should be activated that way. That will now acknowledge the program in parts and tries to implement them in your client. Since we have delegated and activated the function Asynchronously, at the end of the function it will automatically perform a callback which will let you go back to the initial function. But we don’t want to do that since there are still functions that the program has to perform.
To prevent a CallBack use: void CallBackMethod at the end of the function. Repeat the codes in each function.
The client side is really simple. Since each program is separated, there is a tendency that everything will run at the same time. Separate each delegate by advising the client to get the programs separately. You can do that by delaying the activation in each function. To maintain the function of the long program, it is recommended to delay each function in the long process for at least 60 seconds each or if you’re in a hurry, you can reduce the wait time to 15-30 seconds.