Unable to recreate JSESSIONID cookie in Internet Explorer
Hello All,
(Running CF Version: 9,0,0,251028, Windows 2008 Server, IIS-7)
I am using the code below to expire the JSESSIONID cookie that is generated by CF because CF does not set the "HTTPOnly" and "Secure" cookie attributes by default when the JSESSIONID is initially created . I am then recreating the JSESSIONID cookie with the required attributes.
This works great for all browsers EXCEPT Internet Explorer!
When the code below runs in Internet Explorer, the JSESSIONID cookie does become expired as it should as seen in the 1st line of the function below. However, The script after that fails to recreate the JSESSIONID in Internet Explorer. this is driving me nuts because it works like a charm in ALL other browsers.
I am aware of the solution which involves setting these attributes in an xml configuration file on the CF server. However that solution is not an option for me. I am forced to use the method below to setup my secure/httponly JSESSIONID cookie. Any ideas would be greatly appreciated!!!
<cffunction name="OnSessionStart" output="false" access="public" description="I fix the sessionid">
<cfcookie name="JSESSIONID" expires="now"/>
<cfscript>
var.HTTPOnly = "HTTPOnly";
var.domain = cgi.server_name;
var.path = "/";
var.secure = "Secure;";
var.response = getPageContext().getResponse();
var.header = "JSESSIONID" & "=" & session.sessionid & ";domain=." & var.domain & ";path=" & var.path & ";" & var.secure & var.HTTPOnly;
var.response.setHeader("SET-COOKIE", var.header);
</cfscript>
<cfreturn />
</cffunction>
