Wednesday, December 03, 2008

Creating a Loading Page in ASP.NET

To display a waiting page while database or other lengthy work is done, you can use the Response.Write method to send text to the browser while keeping the HTTP connection alive. After your lengthy operation is complete, simply dump a javascript redirect, close the connetion and you are done.

For Example:
  Response.Write("<h3>Please wait...</h3>");
  Response.Flush();
  //Lengthy Operation
  string RedirectUrl = "<script language=javascript>window.location = \"done.aspx\";</script>";
  Response.Write(RedirectUrl);
  Response.End();

No comments:

Post a Comment