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

  1. #1

    Default Help with cookies

    I'm having trouble accessing my cookies after they're set. If I do a
    response.write on the cookie value immediately after it's set in code,
    it writes out the cookie value as it should. But when I come back to
    the page the cookie is null and I can no longer access it.

    Here's my add code:

    DateTime expireCookie = DateTime.Now;
    expireCookie.AddYears(5);

    HttpCookie vandalayCookie = new HttpCookie("VandalayCookie");
    vandalayCookie.Expires = expireCookie;
    vandalayCookie.Values.Add("UserName",opUser.Select edValue);
    vandalayCookie.Values.Add("Password",txtPassword.T ext);

    //Write cookie out to client
    Response.Cookies.Add(vandalayCookie);

    Here's my retrieval code:

    HttpCookie VandalayCookie = Request.Cookies["VandalayCookie"];

    if (VandalayCookie != null)
    {
    opUser.SelectedValue = VandalayCookie.Values.Get("UserName");
    txtPassword.Text = VandalayCookie.Values.Get("Password");

    }

    My retrieval code always evaluates the VandalayCookie as null and
    never retrieve the values. I've even added my site to my list of
    trusted sites and sites that I accept cookies from and still no luck.
    Is there something I'm not doing right?

    Thanks,
    Josh
    Josh King Guest

  2. Similar Questions and Discussions

    1. Cookies in FMS
      In my application Flash Media Server 2 makes HTTP requests to retrieve configuration data. Page that is requestet sets some cookies. I was very...
    2. php cookies
      Is it possible to set php cookies to delete after a period of user inactivity & if so how?
    3. PHP and cookies
      ok I have a question maybe this might help if you have $_COOKIE that is a session cookie in path '/' you also have a cookie $_COOKIE that is a...
    4. cookies under php 4.06
      okay, i know this is stupid, and i'm gonna kick myself when someone points out the obvious... i've just put a site online, and found the server's...
    5. Some cookies are being set, some aren't
      I've got a problem with cookies failing. Here's the setup- A staging server, RedHat Linux, with php 4.3 Main server, FreeBSD, also php 4.3 ...
  3. #2

    Default Help with Cookies

    I am preparing to build many html pages that will have questions followed by
    check boxes, radio buttons and text fields for answers. I am trying to find a
    tutorial that will guide me through the process of building cookies, so that
    when the customer comes back or logs back in, what ever they have finished (for
    example, questions 1 - 10) will still appear and they can continue where the
    left off.

    I own Studio 8, Captivate 1.0.1 and was wondering if i should do this is
    flash, dreameweaver or captivate? Will i have to have a cookie on each page or
    just on the first page of the intial document (html)?

    sailboat420 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