For the long-loaded ASP. NET page, we can display the progress bar in the client browser to show that the page is loading. Here is the specific implementation process:
Create a new project with the name Webportal, select a Visual C # project in the project type, or a Visual Basic project;
Select the ASP. NET Web application in the template type;
Position input: http://localhost/WebPortal;
Add New item: A Web Form with the name ShowProgress.
Add any additional Web server controls on your Web Forms showprogress.aspx.
Right-click on the showprogress.aspx, point to "View Code" and enter it at the top:
Visual C #. NET code
usingSystem.Threading; Visual Basic. NET code imports System.Threading in the Page_Load event: Visual C #. NET Code Response.Write ("<div id= ' mydiv ' >"); Response.Write ("_"); Response.Write ("</div>"); Response.Write ("<script>mydiv.innertext = ';</script>"); Response.Write ("<script language=javascript>;"); Response.Write ("var dots = 0;var Dotmax = 10;function showwait ()"); Response.Write ("{var output; output = ' loading page ';d ots++;if (Dots>=dotmax) Dots=1;"); Response.Write ("For (var x = 0;x < dots;x++) {output + = ';} Mydiv.innertext = output;}"); Response.Write ("function startshowwait () {mydiv.style.visibility = ' visible ';"); Response.Write ("window.setinterval (' showwait () ', +);}"); Response.Write ("function hidewait () {mydiv.style.visibility = ' hidden ';"); Response.Write ("window.clearinterval ();}"); Response.Write ("startshowwait ();</script>"); Response.Flush (); Thread.Sleep (10000); Visual Basic. NET Code Response.Write ("<div id= ' mydiv ' >") Response.Write ("_") Response.Write ("</div>") Response.Write ("<script>mydiv.innertext = ';</script>") Response.Write ("<script language=javascript>;") Response.Write ("var dots = 0;var Dotmax = 10;function showwait ()") Response.Write ("{var output; output = ' loading page ';d ots++;if (Dots>=dotmax) Dots=1;") Response.Write ("For (var x = 0;x < dots;x++) {output + = ';} Mydiv.innertext = output;}") Response.Write ("function startshowwait () {mydiv.style.visibility = ' visible ';") Response.Write ("window.setinterval (' showwait () ', +);}") Response.Write ("function hidewait () {mydiv.style.visibility= ' hidden ';") Response.Write ("window.clearinterval ();}") Response.Write ("startshowwait ();</script>") Response.Flush () Thread.Sleep (10000) in the HTML of the Showprogress.aspx form, enter:<script>hidewait ();</script>
Click to view in the browser