Click here to Skip to main content
12,892,589 members (48,225 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 10 Aug 2013

Automatic Page Refresh in ASP.NET

, 10 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
How to do automatic page refresh in ASP.NET


The web page that is displayed when you type a URL, for example, is in response to the request sent to the web server. It uses HTTP (Hypertext Transfer Protocol) to transfer data between a client (a web browser) and a server. Any request sent to a web server is processed at the web server and a response is sent to the client. For example, when the user clicks on a Submit button, data is sent to the web server as a request, the server processes the request and sends the response. The process is triggered by the user to send the request.

But in some situations, we may require to refresh a page automatically at a pre-defined time interval. This might not be recommended when you are using latest technologies like AJAX, but some developers might need to do this.


We can achieve this using the META tag as shown below (where Dashboard.aspx is the page that needs to be refreshed):

<meta http-equiv="refresh" content="30">

<meta http-equiv="refresh" content="30;url=Dashboard.aspx">  

Using ASP.NET, C# and MasterPages

These days, using Master Pages is common in many ASP.NET projects. If you use the META tag in this case, then all pages that use this master page will be refreshed, which is not desired. To accomplish this, add the following C# code in the code-behind page of the particular page you want to refresh (for example, Dashboard.aspx):

Response.AppendHeader("Refresh", 30 + "; URL=Dashboard.aspx");   


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Srinivas Kalabarigi
Technical Lead
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 3 Pin
satish koladiya26-Aug-13 23:34
professionalsatish koladiya26-Aug-13 23:34 
GeneralMy vote of 5 Pin
ketan italiya12-Aug-13 21:46
professionalketan italiya12-Aug-13 21:46 
GeneralMy vote of 1 Pin
Dmitry A. Efimenko12-Aug-13 8:03
memberDmitry A. Efimenko12-Aug-13 8:03 
GeneralMy vote of 5 Pin
Carsten V2.010-Aug-13 22:15
memberCarsten V2.010-Aug-13 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 10 Aug 2013
Article Copyright 2013 by Srinivas Kalabarigi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid