Print Page | Close Window

redirect in 5 seconds?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9569
Printed Date: 31 March 2026 at 11:22pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: redirect in 5 seconds?
Posted By: Lucent
Subject: redirect in 5 seconds?
Date Posted: 05 February 2004 at 11:42am

Hi, how do I edit this code so It will redirect within whatever second I set it to?

<%
session.abandon
response.redirect("/login_form.asp")
%>




Replies:
Posted By: Semikolon
Date Posted: 05 February 2004 at 11:53am

not possible with serverside... you can place this inside <head></head>:

<meta http-equiv="refresh" content="3;URL=/login_form.asp">



Posted By: dpyers
Date Posted: 06 February 2004 at 1:55am

Put a timer function...

<%

'****************************************
'**      Loop for X Seconds          ;   **
'****************************************

Dim intPauseSeconds     'Holds the Number of Seconds to elapse
'Declare the Timers
Dim tmrStartTime
Dim tmrEndTime
Dim tmrRunTime

Public Function funcWaitForTime(intPauseSeconds)
' This Function loops for the number of seconds specified in the strPauseSeconds variable
' The Time() function returns the number of seconds that have elapsed since midnight.
' It is not precise.

tmrRunTime = 0
tmrStartTime = Timer()
tmrEndTime = Timer()

Do while tmrRunTime < intPauseSeconds
   tmrEndTime = Timer()
      'The If statement handles any date change while the loop is executing
      If tmrStartTime > tmrEndTime Then
          tmrEndTime = tmrEndTime + 86400
      end If
    tmrRunTime = tmrEndTime - tmrStartTime
Loop
End Function

funcWaitForTime(5)
session.abandon
response.redirect("/login_forum.asp")
%>



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: pmormr
Date Posted: 06 February 2004 at 8:44am
looks like it uses a lot of CPU cycles

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: dpyers
Date Posted: 06 February 2004 at 5:55pm
Yup, but the http refresh does as well although in that case the loop is handled by iis, not by the app so it's more efficient but not great. x86 architectures just don't handle time that well although x86 *nix os's manage to work around it much better than ms.

-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net