Auto-refresh an ASP.NET (.aspx) Web Page.

Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 6682
Hi it's easy to refresh web-page in

Automatic web page refresh can be implemented in an ASP.NET in ".aspx" pages by adding some HTML code in the Header Section.

We can simply add following line of code in the Header Section to enable auto refresh in an ASP.NET web page.

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

Where 30 refers to the number of seconds it will take before refreshing the page.

Also we can redirect to a specific page if we put the URL inside the tag.

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

Here,after 30 seconds,page will redirect to "" website.

If we want to set the Refresh Time dynamically then that can be done in ASP.NET by adding server side code in the Page_Load event to set it.

We the help of AppendHeader method of Response object ,we can increase/decrease Refresh-Time as shown below:-

protected void Page_Load(object sender, EventArgs e)

Then after 45 second,page will refresh.

Comments or Responses

Posted by: t5j9033387989 on: 12/19/2013 Level:Starter | Status: [Member] | Points: 10
very intersting thanks for posting this.
Posted by: vishalneeraj-24503 on: 12/19/2013 Level:Platinum | Status: [Member] [MVP] | Points: 10
Welcome 9033387989 :)

Login to post response