Cookie problem

T

tshad

I am trying to write out and update my cookies, but it doesn't seem to work
correctly. I am using the following code:

if (passwordSaveCookie.checked) then
If Request.Cookies("User") is nothing Then
Dim cookie As New HttpCookie("User")
cookie.Values.Add("UN",UN.Text)
cookie.Values.Add("UFN",dbReader("FN"))
cookie.Values.Add("ULN",dbReader("LN"))
cookie.Expires = DateTime.MaxValue
Response.AppendCookie(cookie)
else
response.Cookies("User")("UN") = UN.Text
response.Cookies("User")("UFN") = dbReader("FN")
response.Cookies("User")("ULN") = dbReader("LN")
End If
end if

What seems to be happening is that if you already have a cookie and you say
to save the cookie, it ties to save the cookie and shows the new cookie in
the Cookie manager in Mozilla. So it seems to work.

But if you close the Browser and look, it isn't there.

If you now try to save it, it will work.

So it takes two times to make the change. The first time it will delete the
cookie (even though it shows the new cookie there) and then when you try the
next time (after the cookie is gone), it works fine.

What am I missing here?

Thanks,

Tom
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top