File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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 example.com but not www.example.com.
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 example.com and www.example.com and http://www.example.com and http://example.com

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
Marshal

Joined: Mar 22, 2005
Posts: 41792
    
  62
That's what the Cookie.setDomain method does.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with Cookie?