You can't use <CFLOCATION> and <CFCOOKIE> on the same page.  <CFLOCATION>
trashes the current HTTP headers where cookies are send and generates new
ones.  Since CF doesn't send the headers until the page is done processiong
your headers with the cookies in them never even get to the browser.

Kevin

----- Original Message -----
From: "Mike Sprague" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 12:25 PM
Subject: cookies not being set


> I have a login page that checks my db to validate user info and if valid
uses cflocation to redirect to the appropriate page.  I need cookies to work
because people with AOL have been having problems keeing the session
variables alive.  My code is below, any help would be greatly appreciated.
>
> Mike
>
>
> <cfif CheckLogin.RecordCount Is 0 Or CheckLogin.RecordCount GT 1>
>   <cfset Session.error_message="Your Login Information Is Incorrect.
Please Try Again.">
>   <cflocation url="/login.cfm" addtoken="No">
> <cfelseif CheckLogin.RecordCount Is 1>
>   <cfcookie name="UserLevel" value="#int(CheckLogin.UserLevel)#"
expires="1">
>   <cfcookie name="LoggedIn" value="true" expires="1">
>   <cfcookie name="Username" value="#CheckLogin.Username#" expires="1">
>   <cfcookie name="UserID" value="#int(CheckLogin.UserID)#" expires="1">
>   <cflocation url="/members/index.cfm" addtoken="Yes">
> <cfelse>
>   <cflocation url="/login.cfm" addtoken="No">
> </cfif>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to