Keeping a session alive

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Keeping a session alive

    If I create a session on page 1, like this:

    <cfif IsDefined ("Form.txtFirstName")>
    <cfset Session.first_name=#FORM.txtFirstName#>
    <cflocation url="testsession2.cfm">
    </cfif>

    And on page 2 I have this:
    <cfoutput>#Session.first_name#</cfoutput>

    It outputs the session variable as expected.

    If I create a page 3 with this code:
    <cfoutput>#Session.first_name#</cfoutput>

    Shouldn't it still output the session variable? I'm getting an error saying
    "Element fist_name is undefined in SESSION"


    MMForums Guest

  2. Similar Questions and Discussions

    1. Live streams keeping alive
      Hello, I'm using HTTP Administration API to poll for a list of live streams and their status (getLiveStreams, getLiveStreamStats). I'm doing it...
    2. Keeping server-side object alive
      I'm trying to wrap a protocol behind a web service, the problem is that part of this protocol involves a thread that waits for asynchronous events...
    3. SoapHttpClientProtocol and Keep-Alive
      My client application uses an instance of System.Web.Services.Protocols.SoapHttpClientProtocol. I would like to use the HTTP 1.1 Keep Alive header...
    4. [PHP-DEV] before beta2 (is alive again) :-)
      ----- Original Message ----- MB>From: "Marcus Börger" <marcus.boerger@t-online.de> MB>To: "Cristiano Duarte" <cunha17@uol.com.br> MB>Sent:...
    5. Help with session keep alive code using .asp as img src
      I've got a standard form on an ASP page to collect resumes from visitors. The page can be accessed only after the visitor has logged into the site....
  3. #2

    Default Re: Keeping a session alive

    You need to create Application.cfm (CFAPPLICATION) and determine the session
    variable life time. Like this:

    <cfapplication name="YourApplicationName" clientmanagement="Yes"
    sessionmanagement="Yes" setclientcookies="Yes"
    sessiontimeout="#CreateTimeSpan(0,0,1,0)#"
    applicationtimeout="#CreateTimeSpan(0,0,1,0)#">

    In this example, the session timedout after one hour.


    Laksma

    Laksma Guest

  4. #3

    Default Re: Keeping a session alive

    I have an application.cfm file already:

    <cfapplication
    name = "PSIntranetAPP"
    setClientCookies = "No"
    ClientManagement = "Yes"
    sessionManagement = "Yes"
    sessionTimeout = "#CreateTimeSpan(0,0,20,0)#"
    >
    So, should the code I outlined work the way I think it should?

    --
    Bill Horvath
    Free Tutorials for Studio MX
    [url]http://www.communitymx.com/free.cfm[/url]
    Free 10 Day Trial
    [url]http://www.communitymx.com/joincmx.cfm[/url]

    "Laksma" <webforumsuser@macromedia.com> wrote in message
    news:d958dv$9op$1@forums.macromedia.com...
    > You need to create Application.cfm (CFAPPLICATION) and determine the
    session
    > variable life time. Like this:
    >
    > <cfapplication name="YourApplicationName" clientmanagement="Yes"
    > sessionmanagement="Yes" setclientcookies="Yes"
    > sessiontimeout="#CreateTimeSpan(0,0,1,0)#"
    > applicationtimeout="#CreateTimeSpan(0,0,1,0)#">
    >
    > In this example, the session timedout after one hour.
    >
    >
    > Laksma
    >

    Bill Horvath .:CMX:. Guest

  5. #4

    Default Re: Keeping a session alive

    So, should the code I outlined work the way I think it should?

    Yes it should. Any page that runs the application.cfm (anything in the
    folder) should have all variables until the Session times out (or if its the
    first time in). On first-time in (after CFAPPLICATION) you should default all
    Session variables that you'll be using. A pain but it will avoid errors, when
    people leave a page up and the session times out.

    Did you notice the spelling error, Fist vs. First? "Element fist_name is
    undefined in SESSION"

    JMGibson3 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139