Doug...

Somewhere, you are checking for the session and if it doesn’t exist, you
cflocate to the login page. THAT is the place where you need to grab the
CURRENT page and query strings (or just the entire url for that matter).
Because THAT is the point that you want to return them to.

So...

<cfif NOT isdefined('session.isloggedin')>
        <cfset theurl =
urlencodedformat("http://#cgi.server_name#/#cgi.script_name#?#cgi.query_stri
ng#") />        
        <cflocation="loginpage.cfm?returnto=#theurl#" addtoken="no" />
</cfif> 
 

So now say you are at
'http://mysite.com/securepage.cfm?someurlvar=42' but not logged in and
should be.

You will be redirected to soemthing like...

Loginpage.cfm?returnto=http%3A%2F%2Fmysite%2Ecom%2Fsecurepage%2Ecfm%3Fsomeur
lvar%3D42

Now... when the user logs in successfully you cflocate to:
#urldecode(url.returnto)#


On your login page, give a default for url.returnto.

Also, on the login page, you want to check to see if the user is logged in,
if they are, then they shouldn’t be on a login page. Redirect them to your
default.

..:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 

 


-----Original Message-----
From: Doug Brown [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 18, 2006 9:37 AM
To: CF-Talk
Subject: Re: Still need help!! (Login & <cflocation>)

That is not working. What happens is the user clicks a link for a page in
the root directory and if they are not logged in I <cflocation> them to the
login page. If I use the cgi.http_referrer it sets the last requested page
as the login page from the <cflocation>



Doug


----- Original Message -----
From: "Snake" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Monday, December 18, 2006 7:17 AM
Subject: RE: Still need help!! (Login & <cflocation>)


> Save the referer, and send them back to that.
>
> Russ
>
> -----Original Message-----
> From: Doug Brown [mailto:[EMAIL PROTECTED]
> Sent: 18 December 2006 13:57
> To: CF-Talk
> Subject: Still need help!! (Login & <cflocation>)
>
> This is totally driving me nuts!! For those of you who missed my troubles,
I
> will go over it again. I have a page in the root of my site that requires
a
> user to login. My login page is located in a child directory and I am
> needing to force the user back to the page they were originally looking
for
> prior to login. I cannot seem to be able to <cflocation> them from the
child
> folder back to the root folder where that page is at. I have tried the
code
> below, but it simply does not work, as it is sending them back to the
> index.cfm of the current "CHILD" folder instead of the "ROOT" folder. I
have
> also tried setting the return url prior to login, but that simply sets the
> login page as the last page in the CGI.SCRIPT_NAME. Has anybody handled
this
> problem before and may have a simple solution?
>
>
>
> <CFIF IsDefined("Session.RUserName")>
>  <CFIF Session.RUserName is "Guest">
>   <CFPARAM name="attributes.thispage"
> default="#GetFileFromPath(GetTemplatePath())#">
>   <CFPARAM name="attributes.querystring" default="?">
>   <CFPARAM name="attributes.variablestring" default="#CGI.QUERY_STRING#">
>   <CFSET thispage = attributes.thispage>
>   <CFSET querystring = attributes.querystring>
>   <CFSET variablestring = attributes.variablestring>
>   <CFLOCATION
>
url="index.cfm?page=login&requested=#thispage##querystring#&string=#variable
> string#" addtoken="no">  </CFIF> </CFIF>
>
>
>
>
> Doug
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264300
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to