Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Wait beofre Redirect

Status
Not open for further replies.

ukwebsite

Programmer
Dec 9, 2000
82
0
0
GB
Please help. I want to make a page wait for a set number of seconds before it redirects. Im using the following script.

Response.Write image & " Uploaded"

' I WANT A PAUSE HERE BEFORE IT REDIRECTS

Response.Redirect "admin.asp?Area=" & strArea

What do I do?

Cheers
Matthew Wilde
matthew@ukwebsite.com
 
I am a relative newbie to asp but here are a couple of things you could maybe try:

If your page has an html output you could use the refresh command below where you can specify the exact time you wish using the content setting.

<meta http-equiv=&quot;Refresh&quot; content=&quot;5; URL=http://www.yourpage.com&quot;>

otherwise try using a looping statement based upon the time something like

timestart = FormatDateTime(Now, vbShortTime)
timeend = timestart + &quot;100&quot;

Do While timestart > timeend
whatever function you wish to take place and then update timestart
timestart = FormatDateTime(Now, vbShortTime)
Loop
Next
Response.Redirect &quot;admin.asp?Area=&quot; &amp; strArea


I havent actually tested the ability to add onto the time but I dont see why it shouldn't work.


Justin
 
Cheers but the only problem I have is using dll's. The webhosting company dont allow it. I did use the above post regarding the javascript and it works great.

Thanks for you help
Matthew Wilde
matthew@ukwebsite.com
 
Your web hosting company won't appreciate you using the timing loop, because it grabs 100% of the CPU while it is running. Try the code below instead. (The response.writes are just to prove the script is working; take these out of your final code):

response.write &quot;Start... &quot; & time() & &quot;<br>&quot;
Const MESSAGE_TYPE_INFO = 64
Dim oWsh, sPopupText, sPopupTitle, nDelaySeconds
nDelaySeconds = 5
sPopupTitle = &quot;&quot;
sPopupText = &quot;&quot;
Set oWsh = Server.CreateObject(&quot;wscript.shell&quot;)
Call oWsh.popup(sPopupText, nDelaySeconds, sPopupTitle, MESSAGE_TYPE_INFO)
Set oWsh = Nothing
response.write &quot;Done... &quot; & time()

(This doesn't actually create a popup message on the sever, I guess because IIS is a background process).
 
a simple client javascript would be the way to go i think...


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

<%

dim time_in_seconds
dim strArea
time_in_seconds=2
strArea = &quot;area&quot;

with Response 'i think you can do this
.Write image & &quot; Uploaded&quot;
.Write &quot;<script>setTimeout(&quot;&quot;doLeave()&quot;&quot;, &quot;
.Write time_in_seconds & &quot;000);&quot; & vbcrlf
.Write &quot;function doLeave() { location.href=unescape('admin.asp?Area=&quot; & strArea & &quot;'); }</script>&quot;
end with

%>----------------------------------- mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top