It's not a secret anymore!
The moose likes Servlets and the fly likes problem with Cookie? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with Cookie?" Watch "problem with Cookie?" New topic

problem with Cookie?

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
Hi All,
I have a problem with cookie.
I created the cookie with name and value upon login and It is working fine.
The problem is, after login if member clicks on a anchor it is asking to login to see that page (If the page is only for members not for public).
That should not be the case. Because member is already logged in and she can see that page without re-login.

What i found is, in the browser the string it is using for the 'site' is but not
if we open a page like
the browser is treating it as a new domain. that is why it is not sending the valid cookie (which created after member logged in)

How can I use the same cookie for and and and

I want to say all these are related to same domain.

Can any body help me to solve the problem.

Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Does your browser accept cookies? You can check its security setting.
Did you consider using HttpSession?

Thanks and Regards
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
That's what the Cookie.setDomain method does.
I agree. Here's the link:
subject: problem with Cookie?
It's not a secret anymore!