Progress bar in WEB Applications
Julien Cheyssial was written on 2003/10/01
Joise. LI translation and modification
Preface:
The original article is an article I found when I needed to use the progress bar. It provides detailed explanations and examples. I added my own modifications on the basis of the original article: added thread processing and added the use of the progress bar to the Child thread for processing. This is my first translation. please correct me. For more information, see http://www.myblogroll.com/articles/progressbar.
Who said that progress bars cannot be used in WEB applications? I think yes. This article describes how to improve the quality and interface friendliness of WEB applications by using progress bars during a long processing process on the server. In fact, if a WEB application is always running in the stateless and connectionless state, you can easily think that the process is over. However, the progress bar of Java Applets that does not use any ActiveX controls and messy Java Applets described in this article will help to improve this.
The key to using progress bars in a WEB application is the ability of the browser to display pages before all pages are loaded. We will use this feature to generate step by step and send the page to the client. First, we will use HTML to generate a perfect and beautiful progress bar, and then we will dynamically send Javascript blocks to update the progress bar. Of course, all the above content is implemented before the user request is disconnected. In C #, Response. Write allows us to add custom content to the cache and Response. Fluse () allows us to send all the content in the cache to your browser.
Step 1:
The first step is to create a progress bar page. We use progressbar. aspx. As described above, we gradually generate and send the page to the client. First, we will use HTML to generate a perfect and beautiful progress bar. We can obtain the entered HTML code from progressbar.htm, which is defined first. Therefore, the first thing is to load it and send the data stream to the browser of the client. Add the following lines to Page_Load of progressbar. aspx:
String strFileName = Path. Combine (Server. MapPath ("./include"), "progressbar.htm ");