BackUp LevelNext

Redirecting Application Page Requests (CFLOCATION)

You can redirect a page request to another page or to another URL using the CFLOCATION tag. This is useful if you want to define an application page that performs one or more CFQUERYs and then moves on to another page, or if you want the URL to which the user is directed to depend on a dynamic parameter.

Example

For example, you can use CFIF to test if a user is logged in (has the user's password been confirmed?) and if not, relocate the user to another URL using CFLOCATION:

<CFIF #NewPassword# IS NOT `#PasswordConfirmation#'>
    <CFLOCATION URL="invalidpassword.cfm">
</CFIF>

This example manages validation of a new user's password by evaluating whether the new password was confirmed properly. If not, the application page routes the user to a different page that notifies the user that the password was not confirmed properly (for example, "invalidpassword.htm").

It is also possible to use dynamic parameters within the URL attribute of the CFLOCATION tag. For example, to dynamically determine the page to send the user to based on a dynamic parameter named "Page," use the syntax:

<CFLOCATION URL="#Page#">

BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.