Forum Discussion
Steven_Ruby_872
Nimbostratus
Jan 17, 2006more fun with jsessionid persistence
so it seems that some people in development, have decided that we shouldnt make cookies a requirement in our webapp. That means if a clients browser doesnt allow cookies the COOKIE persistence wont wo...
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects