Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Response.Redirect

created by yossarianc

(idea) by yossarianc (1.1 mon) (print)   ?   (I like it!) Wed Oct 17 2001 at 2:33:06

ASP Response Object : Redirect Method

The Redirect method stops processing the current script and tries to connect the end user to a different URL. To accomplish this, the following explicit HTTP header is sent to the end user's browser:

  HTTP 1.1 302 Object Moved
  Location URL
Where URL is the parameter passed to the Redirect method. If, however, page content has already been sent to the end user and a proxy server lies between the server and end user, an error message can be generated. To prevent this, Response.Buffer should be set to True and Response.Clear should be called just before calling the Redirect method.

This method takes one mandatory parameter:

  • URL - the URL to send the end user to

Example:

<%
  Response.Buffer = True

  'any amount of code, response.writes, etc...

  Response.Clear
  Response.Redirect("http://www.everything2.com/")
%>
This will redirect the user to Everything, regardless of the code in between1.

Tips & Hints

Transfer Instead of Redirecting for Internal Pages
With the introduction of ASP 3.0 and IIS 5.0 came some new functionality which largely makes the use of the Redirect method obsolete for internal pages (pages on the same server). You should now use Server.Transfer instead of the Redirect method to send users to different pages on your system.

The reason is that a redirect forces a new page request, resulting in the browser having to connect again to the web server and the server having to handle an extra request. Server.Transfer, on the other hand, transfers execution to a different ASP page on the same server, avoiding the extra browser-to-server connection and resulting in better performance.


Back to the ASP Response Object
Back to ASP Objects
1 As long as Response.End or Server.Transfer aren't called.

Resources:
http://www.devguru.com/
http://msdn.microsoft.com/asp/

All code is my own (and is a seventh cousin of EDB's).

printable version
chaos

Request.ServerVariables ASP Objects pbx ports Port 1984
Port 21 port Sunday Morning Catechism JSP
proxy server error message Redirect URL
Response.End HTTP IIS web server
server Response.Buffer Active Server Pages ASP
response Response.Clear VBScript
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Drink up!
Bait al-Hikmah
John Riggins
The Rise of Islam
Watching my kitty-cat die
You noders still fucking suck, but your needing my wisdoms bad
fish ladder
Little bubble worlds
Andromeda
Cannery Row
The Republic
Watching Robyn Hitchcock
Dmitri Shostakovich
R2-D2
New Writeups
TheOrientalAfrican
July 7, 2008(person)
TheOrientalAfrican
ToTheGuyWithAidsSittingN... (I Am Really Really Sorry)(person)
Heitah
Why I love Everything2(person)
trixingee
Dungeon Mastering for the first time(idea)
Netrat0
It's Called Subtext, Honey(person)
eyeofthebeholder
The Dragon(idea)
Heitah
consist, comprise, constitute, or compose(idea)
Meezzio
Gotlandssnus(thing)
argv
Astral Plane(idea)
Madara
One Winged Angel(fiction)
Tom Rook
Talk is cheap(poetry)
shaogo
Adelle Davis(person)
Aerobe
race car g sfjsgsd(poetry)
Binah
Dream Log: July 5, 2008(dream)
StrawberryFrog
Forgotten things in space(idea)
Everything 2 is brought to you by the letter C and The Everything Development Company