Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple cookies of the same name?  RSS feed

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I read somewhere that you can have multiple cookies of the same name (and path.) I'm guessing this is why there's a response.addCookie() instead of a response.setCoookie(). But does this mean that if I have a cookie that stores the user's most recently used login id, when I add a login cookie with a new value, the browser keeps the old cookie around, so when I search for the loginId cookie in the array returned by request.getcookies() I'll get multiple hits?

Thank you,
Yuriy
 
Jimmy Die
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question!

What happened when you tried it?

If you have created your own login cookies have you had a chance to utilize the HttpSession from response.getSession(). If not check into utilizing this to enhance your code.
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I met this problem. To solve ambiguous situation, I just removed a cookie without corresponding value in a session.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!