#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10

    Redirect to another page after 10 seconds


    hi there ...
    I want my page to redirect to another page by using response.redirect method ... but I want the redirection to be done after 10 seconds ... any help?
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Jun 2004
    Posts
    1,657
    Rep Power
    238
    You can try the following script to do auto redirecting but it is not using asp. If you wish you can make use of this code.

    Code:
    <HTML><HEAD>
    
    <!-- Begin ReDirect Command -->
    <!-- Re-Direct Page JavaScript Code -->
    <meta http-equiv="refresh" content="10;url=http://www.abcxyz.com">
    <!-- End ReDirect Command -->
    
    </head>
    <BODY BGCOLOR="#ffffff">
    <div align="center">
    <center><table border="0" width="290" height="156"><tr><td width="65%"></td><td width="35%"><p align="center"><font face="ms sans serif" size="4" color="#000000"><b>Your Code<br>Demonstration</b></font><br><input TYPE="button" VALUE="Close" onClick="window.close()"></td></tr></table></center>
    </div>
    </BODY>
    </HTML>
  4. #3
  5. creepy-crawly explorer
    ASP Discoverer (100 - 499 posts)

    Join Date
    Apr 2005
    Location
    India
    Posts
    132
    Rep Power
    10

    Red face


    This Function can also be called in the ASP part for page redirection., (2*1000 = 2 seconds)

    Code:
    function doRedirect()
    {
        setTimeout( "window.location.href = sTargetURL", 2*1000 );
    }
  6. #4
  7. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10
    Can you give me an example where this function is used ... thanks
  8. #5
  9. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Jun 2004
    Posts
    1,657
    Rep Power
    238
    You can use this function in OnLoad event of Body tag

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Auto Redirect</title>
    
    <script language =javascript >
    function doRedirect()
    {
        setTimeout( "window.location.href = 'http://www.abcxyz.com'", 2*1000 );
    }
    </script>
    
    </head>
    
    <body onload="doRedirect()">
    Hello
    </body>
    
    </html>
  10. #6
  11. Forever Learning User
    ASP Adventurer (500 - 999 posts)

    Join Date
    Mar 2005
    Location
    Arda
    Posts
    659
    Rep Power
    78
    Here is one you can use. It is all Javascript but has a nice little count down to show the user they are about to be redirected.
    Code:
    <html>
    <head>
    <title></title>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    
      var start=new Date();
      start=Date.parse(start)/1000;
      var counts=45;
      function CountDown(){
        var now=new Date();
        now=Date.parse(now)/1000;
        var x=parseInt(counts-(now-start),10);
        if(document.form1){document.form1.clock.value = x;}
        if(x>0){
          timerID=setTimeout("CountDown()", 100)
        }else{
          location.href="http://www.vaasinc.com"
        }
      }
    
    //  End -->
    </script>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
      window.setTimeout('CountDown()',100);
    -->
    </script>
    
    </head>
    <body>
    <table border="0" width="750" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
      <td width="643" style="color: #000000; font-family: Arial; font-size: 10pt" bgcolor="#FFFFFF" valign="top">
        <p align="center">
        <FORM NAME="form1">
          <p align="center">
          You will be redirected in 
          <INPUT TYPE="text" NAME="clock" SIZE="1" VALUE="10" style="color: #FF0000; font-size: 10pt; font-weight: bold; text-align: center"> seconds.
          </p>
        </FORM>
      </td>
    </tr>
    </table>
    </body>
    </html>
    Change the variable counts to whatever interval you need. Then change "location.href=" to whatever address/page you want them to go to.

    Hope this fits the need.

    - Olórin

    Comments on this post

    • barneybabe agrees : Very good script
  12. #7
  13. Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Aug 2005
    Location
    Moscow, Russia
    Posts
    327
    Rep Power
    22
    Code:
    <%
    Response.AddHeader "Refresh", "10;url=http://aspfree.com/"
    %>
  14. #8
  15. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10
    Thank you guys for your help

Similar Threads

  1. Redirect to a Web Page if Logged On
    By kmuel in forum ASP Development
    Replies: 3
    Last Post: July 24th, 2005, 03:25 PM
  2. aspx page does not redirect to URL when tested on server
    By ikiloh in forum .NET Development
    Replies: 0
    Last Post: May 16th, 2005, 05:34 PM
  3. Redisplay page without redirect
    By mowali in forum .NET Development
    Replies: 1
    Last Post: February 10th, 2005, 12:51 AM
  4. asp page does not work to send receipt to customer
    By njlech in forum ASP Development
    Replies: 4
    Last Post: September 22nd, 2004, 04:27 PM
  5. Replies: 1
    Last Post: December 6th, 2000, 04:58 AM

IMN logo majestic logo threadwatch logo seochat tools logo