If you are developing on ASP.Net 1.1, the first thing which makes you lose the will to live (especially, if you’re accustomed to ASP.Net Ajax) is obviously the missing AJAX framework!
There is very little you could do with ASP.Net Forms for example, displaying a notification screen when you are processing something in the background after a post pack.
0] Create a session object , let it be an instance of a class which has some properties than can be set.
1] In the Form_Load hander, invoke your lengthy process depending on a Boolean property in your session object.
3] On the dreadful postback, when you want to start the ‘lengthy process’, Set your session object’s Boolean property and do a Response.Redirect(“yourwaitingscreen.aspx”). This will show the waiting screen immediately, however you have still not started the lengthy process.
4] Finally, starting the lengthy process is easy.
Add this in your <meta> tag to “yourwaitingscreen.aspx” to do the magic.
<meta http-equiv=”refresh”; content=1 url=”your_lengthy_process_aspx_page.aspx”>
I can hear the Gotchas !!! and ahas!!! now.
The way asp.net processes the request is still synchronous., remember no AJAX either. But, we are taking advantage of the synchronous processing itself. i.e when we add the
‘<meta http-equiv=”refresh”; content=1 url=”your_lengthy_process_aspx_page.aspx”>’ line to
“yourwaitingscreen.aspx”, you are loading the page, which starts the ‘lengthy process’, but since you are already in the ‘waiting screen’, you need not do anything. you also get a progress bar with IE and Firefox etc. (bonus!!!)
Drawbacks:- postbacks and logic in your Form_Load to start the ‘lengthy process’ (can be accomplished using a session variable as discussed above)
But, that’s fairly trivial given the fact that you are telling the user that you are doing something in the background which is going to take some time. (as simple as that.) – with a progress bar inherently displayed by the browser.
It’s maintainable because the ‘lengthy process’ can be loosely coupled with your UI or service. You can re-factor/enhance/test your code for ‘lengthy process’ in isolation, which makes it scalable and may be reusable!