You must Sign In to post a response.
  • Category: ASP.NET

    Automatic refresh ASP.NET page ..

    I have gmap on asp page I want refresh that page on interval like after every 5 minutes...
  • #647815

    please check below code:

    Refresh document every 300 seconds:
    <meta http-equiv="refresh" content="300" />

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
    <meta http-equiv="refresh" content="300" />

    <title>Google Maps</title>
    <script src="" type="text/javascript"></script>
    <body >
    <div id="map" style="width: 550px; height: 450px"></div>

    <script type="text/javascript">

    if (GBrowserIsCompatible()) {

    function createMarker(point,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    return marker;

    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(17.5304303,73.8567437),5);

    var point = new GLatLng(18.5244303,78.8567537);
    var marker = createMarker(point,'<div style="width:240px">Marker1<\/div>')


    else {
    alert("Sorry, the Google Maps API is not compatible with this browser");



    Software Engg.

  • #647817
    Use this code in the aspx page

    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <!--The next line of code will refresh the page every 5 minutes-->
    <meta http-equiv="refresh" content="300">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content=""


    SQL Server Programmers and Consultants

  • #647818

    Automatic web page refresh can be implemented in an ASP.NET (.aspx) web-page by adding some HTML code in the header section.

    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">

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

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

    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")

  • #647820
    thank you Software Engg.

    this code work in my site ..

    Sagar pawar
    Software developer

  • #647826

    You can use the below scrtipt to refresh the page in every specified time interval.

    <meta http-equiv="refresh" content="5" />

    You can also redirect to any site say after 5 seconds:

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

    Redirect to immediately:

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

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #647827
    In this Sample page the page will refresh every 10 secs.

    In the Timer1_Tick page you can either redirect to the same page or call a particular method which will do the job for your refresh

    aspx body:
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" id="ScriptManager1" />
    <asp:Timer ID="Timer1" runat="server" Interval="10000" ontick="Timer1_Tick" ></asp:Timer>

    This Page will refresh in 10 mins

    aspx.cs :

    protected void Timer1_Tick(object sender, EventArgs e)

  • #647853
    You may use one of the following code:

    1) Using <meta> tag:

    <meta http-equiv="refresh" content="5; URL=PageToBeFreshed">

    2) Using JavaScript's setTimeOut function:

    <body onload="javascript:setTimeout("location.reload(true);",5);">

    Thanks & Regards
    Paritosh Mohapatra
    Microsoft MVP (ASP.Net/IIS)
    DotNetSpider MVM

  • #648488
    You can refresh the page automatically if you set the time for interval
    Hope the code given below will hel you

    setTimeout("location.reload(true);", timeout);

    The second is a Meta tag:
    <meta http-equiv="refresh" content="600">

    You can set the refresh intervals on the server side


    Kamlesh Mohanty

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.