Cookie Trouble --> disappearing

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Cookie Trouble --> disappearing

    I have 2 pages... in the first page i check to see for
    the existance of the cookie, if found do something else
    set the value and set the cookie.
    (cookie gets set ok)

    I use the following code to read and write the cookie..
    READ..
    Dim stmp As String
    Dim c As HttpCookie =
    HttpContext.Current.Request.Cookies("HD")
    If Not c Is Nothing Then
    stmp = c(Key)
    Else
    stmp = ""
    End If
    Return stmp

    WRITE
    Dim c As New HttpCookie("HD")
    c("DialogTypeID") = DialogTypeID.ToString
    c.Expires = DateTime.Now.AddYears(1)
    HttpContext.Current.Response.Cookies.Add(c)



    Now i navigate to a second page which looks for a cookie
    of a differnt name and reads the value. The following
    code...

    Dim stmp As String
    Dim c As HttpCookie =
    HttpContext.Current.Request.Cookies("HD2")
    If Not c Is Nothing Then
    stmp = c(Key)
    Else
    stmp = ""
    End If
    Return stmp

    Now when i navigate back to the first page the first
    cookie is gone. I look in my localhost cookies and it is
    no longer in the cookie file. PLEASE tell me what is
    going on.

    please.
    thank you in advance...

    dave
    dave Guest

  2. Similar Questions and Discussions

    1. HTTP::Cookie won't store sent cookie
      Hi all, My script requests http://foo.bar.com/ with code that looks a little like this: my $ua = LWP::UserAgent->new; my $cookie_jar =...
    2. Cookies set one time, I delete cookie, cookie is never set again!
      I am having this problem: My PHP script will set a cookie, it's there in my /Cookies folder. I delete the cookie (I have to for testing purposes,...
    3. authentication cookie vs session cookie
      Hi, What are the differences between authentication and session cookies? In my web.config file, I set the cookieless attribute for the...
    4. VisualAge 6 installation trouble on aix 5.2, gcc trouble too :)
      I've installed gcc 3.x from UCLA site. and I got this error - In file included from test.c:23: /usr/include/pthread.h:554: error: parse error...
    5. Can't get Yahoo groups to open, Cookie trouble
      I get a message that my browser does not accept cookies when I try to get into Yahoo Groups. I have them enabled on my internet properties/security.
  3. #2

    Default Re: Cookie Trouble --> disappearing

    Hi,

    if you dont set any of the cookies properties (Domain,Expires...) the
    default is that cookie will be available for the current page. if you
    navigate to other page the cookie die. when you use the Back button the
    browser use cache version of the page. no call is made to the server so
    no new cookie creat and the old one already vanished.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  4. #3

    Default Re: Cookie Trouble --> disappearing

    You are absolutely right and I’m WRONG! I guess I was confused at this
    time, not to mention that dave set the expiration time. sorry!


    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  5. #4

    Default RE: Cookie Trouble --> disappearing

    DId you also "write" cookies in the second web form? Additionally, when
    will you write the cookies, after find that stmp is empty?

    Luke

    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Luke Zhang [MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139