aspose file tools*
The moose likes Servlets and the fly likes Creating Persistent Cookie In Internet Explorer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Creating Persistent Cookie In Internet Explorer" Watch "Creating Persistent Cookie In Internet Explorer" New topic
Author

Creating Persistent Cookie In Internet Explorer

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Hi,

I have the following java code to create a cookie with expiry time of 1 year.



But when I close the browser (IE), I see all the cookies being deleted.

Can anyone help me creating persistent cookies for IE.

Any help is appreciated.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
Pranit Sonawane
Ranch Hand

Joined: Jul 29, 2011
Posts: 165

Recompile...the program again!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

Pranit Sonawane wrote:Recompile...the program again!!!

Ummm, yeah.


A persistent cookie should be created with a path specified. It could just be "/" to indicate the entire domain.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Bear Bibeault wrote:
Pranit Sonawane wrote:Recompile...the program again!!!

Ummm, yeah.


A persistent cookie should be created with a path specified. It could just be "/" to indicate the entire domain.


Thank you for the reply.

I agree that the path that is specified while adding the cookie in response is the location where the cookies are stored.

I modified the code as follows:



So, when the IE is re-opened, those cookies should be visible. But I do not see the same cookies again.

Any comments ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

Did you perhaps tell Internet Explorer to actively block cookies?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Rob Spoor wrote:Did you perhaps tell Internet Explorer to actively block cookies?


Using the plugin developer tools, I can see the cookies being added to the browser!
 
 
subject: Creating Persistent Cookie In Internet Explorer