Copy link to clipboard
Copied
I have a problem with the variables.
i need to use a variable " loginrecord" in all of my cfm pages, its created in my login.cfm and the value of this needed in other page and maybe i need to change it .
in ASP simply we can use SESSION to make a variable global , is there any way in coldfusion ?
also in ASP we have a command SESSION.SESSIONID , so return the unique number from browser and we can se it as a security check for each one of people login to our site and each one is seperate random and unique number , is there any similar in coldfusion ?
Thanks
Alireza
Copy link to clipboard
Copied
You can also use session variables in ColdFusion.
Copy link to clipboard
Copied
i use it but not working
i set it in application.cfm
<cfset request.loginsession=0> |
but when i change the value in other page, ( like index.cfm ) i can not retrive it in other page ( like clients.cfm )
Copy link to clipboard
Copied
You just set a request variable, not a session variable.
<cfset session.foo = "I am a session variable, and will be available on every page viewed by this user, or any program called by these pages, until the session expires">
<cfset request.foo = "I am a request variable, and will be available in all programs called by this current page request.">
<cfset application.foo = "I am an application variable, and will be available on every page within this application viewed by any user, or any program called by these pages, until the application expires">
<cfset server.foo = "I am a server variable, and will be available on every page viewed by any user or any program called by these pages, anywhere on the server">
I would strongly recommend you spend some time reading the documentation, which is very well written and all online.
Dave Watts, CTO, Fig Leaf Software
Copy link to clipboard
Copied
Thanks man , really i am new in coldfusion and i migrate form ASP and .NET , I have some book and also DVDs but its take time and many thing different between ASP and coldfusion.
Copy link to clipboard
Copied
In addition to Dave's comments, if you are writing a new app, consider using Application.cfc instead of Application.cfm. In the long run it will make things simpler.
Copy link to clipboard
Copied
Thanks,
the reason at the moment i stock with this command is i need to have login information available in all the pages to check the security. the good point i had in ASP is SESSION.SESSIONID , it make a unique number base on browser and i can check it if user loged in or no , or if loged in is the same user or other user . i couldnt find same command in coldfusion , and now i use <cflogin> but if i can find the way to have a browser session it help me in other part of my program.
i start coldfusion new ( near a month ) i have some book and Lynda DVDs, also online sources , and in this priod i re developed one of my program from ASP to coldfusion and its work. i am happy of this and help me to develop better and faster . in compare the coldfusion developed one realy is 40% original development in size and 50% faster . i have good background of ASP in last 8 years include MCSD and developed many program for a small and big companies. but i wanna to continue with coldfusion because i found it more helpfull than ASP specialy in FLASH development .
BTW thanks for your help
Copy link to clipboard
Copied
Ali Parsa wrote:
I have a problem with the variables.
i need to use a variable " loginrecord" in all of my cfm pages, its created in my login.cfm and the value of this needed in other page and maybe i need to change it .
in ASP simply we can use SESSION to make a variable global , is there any way in coldfusion ?
Session.loginrecord will make the variable available to all the CFM pages visited during the session.
also in ASP we have a command SESSION.SESSIONID , so return the unique number from browser and we can se it as a security check for each one of people login to our site and each one is seperate random and unique number , is there any similar in coldfusion ?
ColdFusion has session.sessionID, too.