title: Session Cookies and Application.cfm
body: <p>This code in the Application.cfm (I know it should probably be .cfc, but this is some old code dating back to MX) for cookies used to work just fine on CF8 and CF9 - but I moved this to a local directory using CF10 Developer edition and it did not work until I commented out that block. Here's the error when reaching the index.</p>
  
  <pre><code>The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
  
  Null Pointers are another name for undefined values.
  
  The error occurred in C:/ColdFusion10/cfusion/wwwroot/TFT/Application.cfm: line 3
  1 : &lt;!--- APPLICATION settings ---&gt;
  2 : &lt;cfif IsDefined("cfid")&gt;
  3 :     &lt;cfcookie name="cfid" value="#cfid#" expires="NOW"&gt;
  4 :     &lt;cfcookie name="cftoken" value="#cftoken#" expires="NOW"&gt;
  5 : &lt;/cfif&gt;
  </code></pre>
  
  <p>This is the current code in Application.cfm:</p>
  
  <pre><code>&lt;!--- APPLICATION settings ---&gt;
  &lt;!--- 5/1/13 removed cookies temporarily
  &lt;cfif IsDefined("cfid")&gt;
      &lt;cfcookie name="cfid" value="#cfid#" expires="NOW"&gt;
      &lt;cfcookie name="cftoken" value="#cftoken#" expires="NOW"&gt;
  &lt;/cfif&gt;---&gt;
  
  &lt;!--- Define the application parameters---&gt;
  &lt;cfapplication name="TFTAdmin" clientmanagement="Yes" 
      sessionmanagement="Yes" 
      setclientcookies="No" 
      sessiontimeout="#CreateTimeSpan('0','4','0','0')#" 
      applicationtimeout="#CreateTimeSpan('0','4','0','0')#"&gt;
  
  &lt;!--- Create cookies that disappear when the browser closes as to increase security ---&gt;
  &lt;cflock scope="session" type="readonly" timeout="5"&gt;
       &lt;cfcookie name="cfid" value="#session.cfid#"&gt;
       &lt;cfcookie name="cftoken" value="#session.cftoken#"&gt;
  &lt;/cflock&gt;
  </code></pre>
  
  <p><strong>EDIT</strong>: There's more code in this file - but it seems irrelevant. </p>