Rss Feed Like Us on facebook Google Plus

August 15, 2013

Auto Refresh an Asp.Net Web page


when You want to Refresh a web page automatically..
You 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="15">
Where 15 refers to the number of seconds it will take before refreshing the page.
Also you can redirect to a specific page if you put the URL inside the tag.

<meta http equiv="refreshcontent="15;url=http://www.techimpulsion.in" >
In reality, this is standard HTML functionality and nothing specific to ASP.NET. The same effect of auto-refresh would be seen whether it is an ASP.NET page or just a HTML page, or a page made in Java, PHP, ColdFusion, Perl or the like.
More Preferential for Asp.net Developers

If you want to set the refresh time dynamically then that can be done in ASP.NET by adding server side code in the Page_Load function to set it, as shown below: 
Response.AppendHeader("Refresh", "15")
you can change the refresh time according to your requirement.

© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.