• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to make a page request...

New Here ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

Hi all, I am new to coldfusion. I would like to know how I can make a 'request' from caller.cfm to receiver.cfm passing a variable ('socialsecurity' in this case) securely. I know that inside caller.cfm I can do: <cflocation url="receiver.cfm?socialsecurity=123"> and then in receiver.cfm I can do: <cfoutput>#URL.socialsecurity#.....to print out name. But how can I achieve this without exposing name in the url string. Basically, I want a secure way to pass variables from page to page.

If possible, please provide a very simple working example that I can use as reference.

Thanks so much in advance,
c
TOPICS
Advanced techniques

Views

423

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
LEGEND ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

You have many choices to do what you desire.

Session Variables
#session.aValue#

Client Variables
#client.aValue#

Cookie Variables
#cookie.aValue#

Application Variables
#application.aValue#

Server Variables
#server.aValue#

Form Post Variables
#form.aValue#

Form Get Variables
#url.aValue#

Just to name a few. Each of these scopes have different requirements,
positives and negatives. Which one you choose can depend on many
factors. The most common scope for passing a user piece of data would
be session, but it is by no means the only choice.

Here is a pretty good, if a touch dated, primer on all the various
variable scopes.
[ http://www.depressedpress.com/Content/Development/ColdFusion/Guides/Variables/Index.cfm



Votes

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 ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

Hi Ian, thanks so much for your response, I will read this now and get back to you if I have any questions.

Thanks again Ian,
C

Votes

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 ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

Hi Ian, thanks again, I'm very new in coldfusion, what would be your recommendation if I wanted to pass a variable "name" from page A to Page B. Page B prints it out #name#. However, if the user changes the queryString A.cfm?name=Calvin, then Page B prints out "Calvin". How should I handle this?

Thanks so much,
C

Votes

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
LEGEND ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

If you have just <cfoutput>#name#</cfoutput> and it works with out
throwing an error, then it is finding that variable is some scope. CF
will automatically try several scopes for a variable if you do not
explicitly declare the scope. This is generally considered poor coding,
since it can lead to very confusing and hard to diagnose behavior.

What is the purpose of the values being passed? There are many ways one
can do this, and which one, one chooses depends very much on what one is
trying to accomplish.

A simple example to get your rolling.

pageA.cfm
<cfapplication name="SillyExample" sessionmanagement="yes">
<cfset session.aVar = "FooBar">

pageB.cfm
<cfapplication name="SillyExample" sessionmanagement="yes">
<cfoutput>#session.aVar#</cfoutput>

This is extremely rudimentary, and not standard pratice. One is
strongly advised to work through any of the "Getting Started" material
provided by Adobe to understand what one is doing.

Votes

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 ,
Dec 15, 2006 Dec 15, 2006

Copy link to clipboard

Copied

Hi Ian, thank you for your help, I will go through the "Getting Started" material to get myself more knowledge.

C

Votes

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
Community Expert ,
Dec 16, 2006 Dec 16, 2006

Copy link to clipboard

Copied

A simple example to get your rolling.

pageA.cfm
<cfapplication name="SillyExample" sessionmanagement="yes">
<cfset session.aVar = "FooBar">

pageB.cfm
<cfapplication name="SillyExample" sessionmanagement="yes">
<cfoutput>#session.aVar#</cfoutput>


Yet another silly example:

Application.cfm
<cfapplication name="SillyExample" sessionmanagement="yes">

pageA.cfm
<cfset session.aVar = "FooBar">

pageB.cfm
<cfoutput>#session.aVar#</cfoutput>


Votes

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 ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

Hi BKBK, thanks for your example !

Thanks again,
C

Votes

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
Community Expert ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

LATEST
!

Votes

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