cookies not persisting

Discussion in 'ASP .Net' started by John Grandy, Jul 27, 2007.

  1. John Grandy

    John Grandy Guest

    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);
     
    John Grandy, Jul 27, 2007
    #1
    1. Advertising

  2. John Grandy

    Riki Guest

    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
     
    Riki, Jul 28, 2007
    #2
    1. Advertising

  3. John Grandy

    John Grandy Guest

    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
    >
     
    John Grandy, Jul 30, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lee Wilkie
    Replies:
    2
    Views:
    669
    Lee Wilkie
    Feb 6, 2004
  2. Brano
    Replies:
    4
    Views:
    4,764
    Juan T. Llibre
    Mar 31, 2006
  3. Homer J. Simpson
    Replies:
    0
    Views:
    522
    Homer J. Simpson
    Sep 5, 2007
  4. _Who
    Replies:
    7
    Views:
    2,686
  5. Aaron Smith

    WEBrick cookies not persisting?

    Aaron Smith, Jan 19, 2007, in forum: Ruby
    Replies:
    1
    Views:
    122
    Aaron Patterson
    Jan 19, 2007
Loading...

Share This Page