Sometimes you would like to accomplish some task on a Page which takes more time than is set as “timeout” and you are seeing Request timed out in your browser.
This type of error is not so informative for end-user and is not beautiful for a complete solution.
SharePoint default solutions solving this kind of problems with “Operation in Progress” page:
SharePoint API proposes SPLongOperation named class to solve this problem the same way in your custom solutions.
This class provides you two main methods: Begin() and End(); and to properties: LeadingHTML and TrailingHTML, which can be set to show custom text.
Between calling Begin and End methods you can complete long operations. Code example: