Cookies gone when I close the browser :-(

Results 1 to 3 of 3

Thread: Cookies gone when I close the browser :-(

  1. #1
    Alicia Louis Guest

    Default Cookies gone when I close the browser :-(

    Hi there, I am trying to keep a user name in a textbox in my asp page using cookies, so that the name always kept in the textbox whenever the user get back to my site, but the value in the textbox will be empty after I close the browser.<BR>How can I keep the cookies value in the user hardisk? <BR><BR>Please advice. Thanks.

  2. #2
    ASP Guy Guest

    Default RE: Cookies gone when I close the browser :-(

    How are you testing it or doing it?<BR>I tried the following and it worked fine.<BR><BR>First page which is index.asp<BR>&#060;html&#062;<BR>&#060;body&#062;< BR>&#060;form method="post" action="cookies.asp"&#062;<BR>&#060;input type="text" name="name"<BR> value="&#060;%=request.cookies("name")%&#062;" &#062;<BR>&#060;input type="submit" value="Enter your name"&#062;<BR>&#060;/form&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR><BR>second page which is cookies.asp<BR>&#060;%<BR> response.cookies("name") = request.form("name")<BR> response.redirect("index.asp")<BR>%&#062;<BR><BR>I tried this then closed the page and came back to the first and it still had the name in it.<BR><BR>What does your code look like?

  3. #3
    Join Date
    Dec 1969

    Default RE: Cookies gone when I close the browser :-(

    Try setting a long expiration date on the cookie. For example:<BR><BR>Response.Cookies("USERID") = "Whatever"<BR>Response.Cookies("USERID").Expir es = Date + 3650<BR><BR>This sets the cookie and expires it after about 10 years :-)<BR><BR>Good luck!<BR>John<BR>

Posting Permissions

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