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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect

Status
Not open for further replies.

PeteCan

Programmer
Jan 15, 2002
60
GB
How can I redirect the user to another page but put a delay on it.

I.e. a message is displayed on the page saying you will be redirected to xxxxx.htm in 10 seconds
 
Your best bet for this is to create your page with the nice message in but add this meta-tag:

<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;10;URL=http://www.newurl.com/xxx.htm&quot;>

Where 10 is the number of seconds you wish them to be hanging around for.

However, don't we spend enough time waiting for pages to be loaded without this? Why can't you just redirect as normal? Derren
[Mediocre talent - spread really thin]
 
Thanks for that, is there anyway I can pass variables across as part of the redirect so I can perform different actions on the redirect page?
 
Yes, the redirect page is just another asp page, so you can pass as many parameters to it as you like. You can even substitute the urls in the meta tag based on a querystring:

<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;<%=timedelay%>;URL=<%=yourvariable%>&quot;;> Derren
[Mediocre talent - spread really thin]
 
I'm fairly new to this so I apologise for my ignorance/stupidity but basically I have this

<%
Dim Flag
Flag=&quot;1&quot;
%>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;5;URL=AuthRaise.asp&quot;>
<B>You didn't enter the correct username and/or password</B>
%>
I want to add the Flag variable into the redirect so I can read the value on the destination page, tried using the info you sent but couldn't get it to work.

Thanks
 
Aha!

<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;5;URL=AuthRaise.asp?flag=<%=flag%>&quot;>

Then when you are on the authraise.asp page you can read the value of flag by requesting:

flagvalue = request.querystring(&quot;flag&quot;)
Derren
[Mediocre talent - spread really thin]
 
If I undestand this correctly, the purpose of what you are doing is to make sure that the user has to wait a few seconds before they can make a second attempt to login?

If this is the case, then what you are doing is a very good idea. It's a good way to do some basic protection against a Denial of Service attack. Someone tries to tie up the server by having the page keep hitting the server/database until they have caused so much delay that everyone else can't get in. Sometimes a simple 5-10 second delay can disrupt these attacks becuase the script they are running against you, normally isn't set up to handle a delay before it can hit you again.

Very good idea, that more people need to implement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top