The Long-Running Operation page is familiar to anyone who uses Microsoft Office SharePoint Server 2007. It is called many things (including the spinning gears page and the spinning wheel) but it all comes down to a consistent UI for times when SharePoint Server needs to be doing a lot of work but the user is sitting and waiting. The ability to mimic this default functionality can make your application fit in with the rest of SharePoint Server.
The code for a long-running operation is simple: whatever code you place between your calls to Begin and End constitutes the long-running operation.
using (SPLongOperation operation = new SPLongOperation(this.Page))
operation.LeadingHTML = "Please wait while the operation runs";
operation.TrailingHTML = "";
ProcessResults = "Operation Completed Successfully";
ProcessResults = "An error occurred and was handled.";
this.Context, "result=" +
The heart of the long-running operation happens in between the .Begin statement and the .End statement. While any code you place in between these two statements is running, the user sees the long-running operation page. When your work is complete, the .End statement is responsible for redirecting the user to whichever page you need them to view next—for example, a results page, settings.aspx, or the next page in a wizard.