Forum Discussion
Deb_Allen_18
Jun 20, 2006Historic F5 Account
For setting the persistence entry on the response, the final rule in this post worked: (Click here) , although as noted, the server /can/ set more than one Set-Cookie header when setting multiple cookies, so you might need to do some additional coding to find it.
I've used variations on the theme for a couple of other customers since, for both ASP & jsession ID's, and it seems to do the trick. (We have not yet run into multiple Set-Cookie headers.)
You'd just need to add condtional logic in the request event to look for the cookie then fall back the URI if no cookie:
if {[HTTP::cookie exists ASP.NET_SessionId] }{
set SessionId [HTTP::cookie ASP.NET_SessionId]
else {
set SessionId [HTTP::uri findstr "ASP.NET_SessionId=" 17 24]
}
(of course adjusting the offset / length of findstr to match your cookie name & value lengths)Since the cookie will be set by the server regardless of whether the client will ever use it, I think you're safe to exclusively extract the value from the Set-Cookie header, rather than from the payload.
Your last statement is correct. The request event /could/ conditionally use cookie persistence in the presence of the cookie, but since you're creating the uie persistence record, probably easier & more consistent to just use that. (Otherwise I think you might have to coordinate expiry of the cookie with expiry of the persistence record... not sure, I'll leave that for you to think through.)
HTH
/deb