Using JsessionID without CFID and CFTOKEN in a Posted Form
I'm stumped on this one, and I'm sure there's a simple explanation. Some of our code must be able to handle the possibility that we will have users with cookies disabled. Using jsessionid, manually setting cookies, everything works fine, but then I found, when passing jsessionid in urls, I'm unable to get CF to recognize jsessionid when it's included in the URL of an action attribute of a form with method="post". It seems to work fine tagging jsessionid on to URLs in cflocations, anchor tags, or including it as a hidden form field in a form with method="get".
We're using CF 9.01 with J2EE session management enabled, IIS 7, and accessing an SSL encrypted domain. Disabled cookies in the browser.
Using the example code below (for a file named test.cfm), the second and third options work as expected, but when using the "This is a post submit" button, the sesson breaks, despite the fact that the query string and the URL in the address bar are the same for all three. The only notable differences in CGI variables are the aformentioned request_method of "post" instead of "get" and a Content_Type of "application/x-www-form-urlencoded" instead of an empty string.
And in other news, using the full session.urltoken with all three variables doesn't seem to help. I should note I haven't ever run into this problem using CFID and CFTOKEN in CFMX or in CF 9.01 without J2EE session management enabled.
If anyone has any insight or can reproduce this result using the code below (saved to a file named test.cfm), please let me know. I'd be shocked if there wasn't a fairly pedestrian reason for it, and an easy fix. I've just been staring at this for too long. ![]()
<cfapplication
name="MyApplication"
sessionmanagement="yes"
setclientcookies="no"
sessiontimeout="#createtimespan(0,0,20,0)#">
<cfset sessionthinger= "jsessionid=#session.sessionid#">
<cfoutput>
Now submitting: #sessionthinger#
<br><br>
<form action="test.cfm?#sessionthinger#" method="post">
<input type="submit" value="This is a post submit">
</form>
<br>
<form action="test.cfm" method="get">
<input type="hidden" name="jsessionid" value="#session.sessionID#">
<input type="submit" value="This is a get submit">
</form>
<br>
<a href="test.cfm?#sessionthinger#">This is an anchor link</a>
</cfoutput>
<br><br>
<cfdump var="#session#" label="session scope">
<br><br>
<cfdump var="#url#" label="url scope">
<br><br>
<cfdump var="#form#" label="form scope">
<br><br>
<cfdump var="#cgi#" label="cgi scope">
