• Post Reply Bookmark Topic Watch Topic
  • New Topic

Get cookies from "parent domain"

 
Oliberto Sandoza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I have a JSP page hosted in "subdomain.domain.com". Another website in "domain.com" generate a cookie "prusr". I use the following code in the page hosted on "subdomain.domain.com" to get the cookies:



The problem is that this code do not get the cookie genereted by the website hosted on "domain.com", I think this is normal only to get cookies for the domain you're working on (or am I wrong?).

Is there a way to get cookies from "domain.com" in a page hosted in "subdomain.domain.com" ?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set domain name of cookie to ".domain.com" instead of the default value (the current domain).
 
Oliberto Sandoza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thank you for your quick reply Bauke Scholtz , I'm gonna try that.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at RFC 2965 - the definitive specs on Cookie rules.

Bill
 
Oliberto Sandoza
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked the domain name of the cookie as you noted Bauke and it works! Thank you.

Thank you for the note on the RFC William, useful information.

Thank you both for the quick answer.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!