Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > cookies not persisting

Reply
Thread Tools

cookies not persisting

 
 
John Grandy
Guest
Posts: n/a
 
      07-27-2007
I'm not finding cookies I create to persist. I don't see any corresponding
file in

C:\Documents and Settings\jgrandy\Local Settings\Temporary Internet Files

and the cookie is not present in the Request.Cookies collection on postback.

Here is how I am creating the cookie :

HttpCookie cookie = new HttpCookie("MyCookie");
cookie.Expires = DateTime.Now.AddYears(1);
cookie.Value = "written " + DateTime.Now.ToString();
cookie.Path = "folder1/folder2";
Response.Cookies.Add(cookie);



 
Reply With Quote
 
 
 
 
Riki
Guest
Posts: n/a
 
      07-28-2007
John Grandy wrote:
> I'm not finding cookies I create to persist. I don't see any
> corresponding file in
>
> C:\Documents and Settings\jgrandy\Local Settings\Temporary Internet
> Files
> and the cookie is not present in the Request.Cookies collection on
> postback.
> Here is how I am creating the cookie :
>
> HttpCookie cookie = new HttpCookie("MyCookie");
> cookie.Expires = DateTime.Now.AddYears(1);
> cookie.Value = "written " + DateTime.Now.ToString();
> cookie.Path = "folder1/folder2";
> Response.Cookies.Add(cookie);


When you set the Path to "folder1/folder2", the cookie will only apply to
files in that folder.
Is your page in that folder?

Secondly, cookies for Internet Explorer are not kept in C:\Documents and
Settings\jgrandy\Local Settings\Temporary Internet Files, but in
C:\Documents and Settings\jgrandy\Cookies.

--

Riki


 
Reply With Quote
 
 
 
 
John Grandy
Guest
Posts: n/a
 
      07-30-2007
Cookies show in both folders. I'm not sure why Explorer shows them that way,
and I'm not sure where they actually are located, but that's how Explorer
shows them.

My page is in the folder pointed to by Cookie.Path, but that setting did
turn out to be the culprit. Not sure why.

"Riki" <> wrote in message
news:...
> John Grandy wrote:
>> I'm not finding cookies I create to persist. I don't see any
>> corresponding file in
>>
>> C:\Documents and Settings\jgrandy\Local Settings\Temporary Internet
>> Files
>> and the cookie is not present in the Request.Cookies collection on
>> postback.
>> Here is how I am creating the cookie :
>>
>> HttpCookie cookie = new HttpCookie("MyCookie");
>> cookie.Expires = DateTime.Now.AddYears(1);
>> cookie.Value = "written " + DateTime.Now.ToString();
>> cookie.Path = "folder1/folder2";
>> Response.Cookies.Add(cookie);

>
> When you set the Path to "folder1/folder2", the cookie will only apply to
> files in that folder.
> Is your page in that folder?
>
> Secondly, cookies for Internet Explorer are not kept in C:\Documents and
> Settings\jgrandy\Local Settings\Temporary Internet Files, but in
> C:\Documents and Settings\jgrandy\Cookies.
>
> --
>
> Riki
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
Persisting tree node expand/collapse state to cookies - part 2 Homer J. Simpson ASP .Net 0 09-05-2007 04:48 PM
WEBrick cookies not persisting? Aaron Smith Ruby 1 01-19-2007 11:17 PM
Cookies not persisting accross pages ASP.NET Brano ASP .Net 4 03-31-2006 02:00 PM
Cookies from ASP.NET app not persisting even when enabled! Lee Wilkie ASP .Net 2 02-06-2004 08:40 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57