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!

General Question about Response.Redirect

Status
Not open for further replies.

Rexolio

Technical User
Aug 29, 2001
230
I've seen a Response.Redirect written 2 different ways...

ONE:

Response.Redirect ("redirectpage.asp")

TWO:

Response.Redirect "redirectpage.asp"
Response.end

What's the difference? Which one is better to use? Does it matter?
 
Hi

Not much, they both do the same thing. The function using brackets is nice because you can then construct a string within those brackets and it all looks contained.

response.redirect("newpage.asp?urlparam=" & yourvar)

I try to always use the response.end so that if the response.redirect doesn't work it stops processing the page. That way you can write "If you have not been redirected in 15 seconds follow this link" etc before the redirect, and handle incompatable browsers courteously. Derren
[The only person in the world to like Word]
 
Both ways will redirect you appropriately. Using the parenthesis will help you, the programmer, sort it a little better within the code, but both ways will work.

The response.end has nothing to do with the response.redirect. Response.end will stop the page from being processed and therefore will not send any more data to the user...

<%
Response.write(&quot;1<BR>&quot;)
Response.write(&quot;2<BR>&quot;)
Response.write(&quot;3<BR>&quot;)

Response.End

Response.write(&quot;4<BR>&quot;)
Response.write(&quot;5<BR>&quot;)
%>

Your output on the page would be...

-----------
1
2
3

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


4 and 5 will not be written to the client because the response object would stop once the server runs across the response.end command.

Hope this helps... -Ovatvvon :-Q
 
heh, derren was quicker on the click (to submit) -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top