Friday, April 19, 2024

ASP Primer: Sending a Response, part 2

ASP Primer:

Sending a Response

by Curtis Dicken


Use these bookmarks
to jump around the tutorial:

Talking to the User

Moving the User Around

Memorizing Stuff About the User



Moving the User Around


is kind of like a call forwarding button. It sends the user on to any location
you designate.


The syntax is virtually
the same as Response.Write. Instead of entering a word or phrase that you
want to be sent to the browser, you enter the URL of the destination that you
want the user to be redirected to. For example:


<% Response.Redirect

"" %>


The code above will send
the user on to the HTMLGoodies web site. You can also assign
a destination from a variable like this:


<% Option Explicit %>

<% Dim strDestination %>


<% strDestination =
"" %>


<% Response.Redirect
strDestination %>


So, why would I ever use


The most common usage
for Response.Redirect is in processing user input. Let’s say, for
example, you have built an ASP application that allows you and your friends to
exchange DVD’s and keep track of them. One of your pages is a form that asks the
user whether they want to add a DVD to the list, delete a DVD from the list,
borrow a DVD or return a DVD. Once they have made a selection you can then send
them off to the appropriate page by using Response.Redirect in
cooperation with a Case statement.


There are, of course,
other valuable uses for Response.Redirect, but the type of situation
listed above is the most common.

<< Previous | Next >>

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles