losing url variable after logging into session

New Here ,
Feb 05, 2015 Feb 05, 2015

Copy link to clipboard

Copied

I have a coldfusion helpdesk application that is secured with a application.cfm login system.  Once a ticket is submitted it sends out an email with a link to view the ticket.  The link contains a url variable to link it back to the correct ticket.  If the user is not logged in, the url variable is stripped off after the login process.  Is there any way to prevent this?

TOPICS
Advanced techniques

Views

388

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Feb 08, 2015 Feb 08, 2015
From your description, at least 2 requests are involved. One request takes the unauthenticated user to the login page. Together with URL variables. I would imagine that a second request then takes him - without URL variables! - from the login form to the form's action page, where his credentials are validated.If so, then that is the expected behaviour. You could change it as follows. Enable session management, and implement the following on the login page:<cfloop collection="#url#" item="myVar">...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 08, 2015 Feb 08, 2015

Copy link to clipboard

Copied

From your description, at least 2 requests are involved. One request takes the unauthenticated user to the login page. Together with URL variables. I would imagine that a second request then takes him - without URL variables! - from the login form to the form's action page, where his credentials are validated.

If so, then that is the expected behaviour. You could change it as follows. Enable session management, and implement the following on the login page:

<cfloop collection="#url#" item="myVar">

    <cfset session[myVar] = url[myVar]>

</cfloop>

This results in ColdFusion storing the value of each URL variable as a variable of the same name in the session scope. Thus, the values of URL.x, URL.y, etc. will be stored, respectively, as SESSION.x, SESSION.y, etc.. You could then transfer the respective values from session back into URL scope in the links in later pages.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

LATEST

That was it.  I thought it has something to do with session variables, I just couldn't figure out how to translate it.  I added the code to my application.cfm and in my view page I added a code to check for the existence

of the url variable.  If it is not there then I write it as a cfset using the session variable.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines