SHARE
Facebook X Pinterest WhatsApp

ASP Primer: Sending a Response, part 2

Written By
thumbnail
Joe Burns
Joe Burns
Jan 4, 2005

ASP Primer:

Sending a Response

by Curtis Dicken

 

Use these bookmarks
to jump around the tutorial:

[Response.Write:
Talking to the User

[Response.Redirect:
Moving the User Around
]

[Response.Cookies:
Memorizing Stuff About the User
]

[What’s
Next?
]

 

Response.Redirect:
Moving the User Around

 

Response.Redirect
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

      
"http://www.HTMLGoodies.com" %>

 

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

 

<% Option Explicit %>

<% Dim strDestination %>

 

<% strDestination =
"http://www.HTMLGoodies.com" %>

 

<% Response.Redirect
strDestination %>

 

So, why would I ever use
this?

 

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 >>

Recommended for you...

ASP Primer: Getting Started
Joe Burns
Jan 4, 2005
ASP Primer: Forming Up
Joe Burns
Jan 4, 2005
ASP Primer: Some Basic VBScript
Joe Burns
Jan 4, 2005
ASP Primer: Sending a Response
Joe Burns
Jan 4, 2005
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.