Main reasons are:
•Auto-redirecting to a new URL after a brief time period
•Refreshing page information periodically
•Maintaining a valid session state indefinitely
•Forcing a specific process to run on the server when the client session has expired.
The following methods are the constructs we have used in our web development projects:
HTML header refresh tag
The most common and best known way – a tag of the following format is placed in the HTML section of the page:
<meta http-equiv="refresh" content="300; url=http://ujjwaladatta.spaces.live.com/">
•where ‘300’ refers to the number of seconds that will elapse before the page is refreshed;
•’url’ is the new url redirect to. It can be excluded which means the current page will be reloaded.
This construct is useful if you have one or two pages which have to auto-refresh, and works for any HTML content type forms.
The downside is the refresh interval cannot be set dynamically, and if you are testing for session timeouts on your site,
you’ll have to embed this construct in every page of the site.
ASP.NET provides the AppendHeader method to the Response object.
Typically the page refresh can be set as follows in an ASP.NET webform (in C#):
Response.AppendHeader("Refresh", Convert.ToString(Session.Timeout * 60 + 5));
Here the page refresh is set to 5 seconds after the client session timeout setting specified in the web.config file.
This construct is useful as it can be placed in a base webform OnLoad() or Page_Load() response method. All derived webforms will then have the same page refresh setting when they are loaded.