B
Ben Amada
Every time a user visits a particular page, I'm using the code below to add
a cookie that expires in 1 day.
My question is, a user may visit this page a few times within one day.
Before adding the cookie each time, do I need to delete the previous cookie?
Or will the new cookie just overwrite the old cookie? I'm trying to avoid
having multiple cookies on the user's machine -- just one. FYI, the cookie
"name" will be the same every time.
==========
Dim objCookie As HttpCookie
Dim ts As New TimeSpan(1, 0, 0, 0)
Dim dt As DateTime = DateTime.Now()
objCookie = New HttpCookie("cookie1", "value1")
objCookie.Expires = dt.Add(ts)
Response.Cookies.Add(objCookie)
==========
Thanks in advance,
Ben
a cookie that expires in 1 day.
My question is, a user may visit this page a few times within one day.
Before adding the cookie each time, do I need to delete the previous cookie?
Or will the new cookie just overwrite the old cookie? I'm trying to avoid
having multiple cookies on the user's machine -- just one. FYI, the cookie
"name" will be the same every time.
==========
Dim objCookie As HttpCookie
Dim ts As New TimeSpan(1, 0, 0, 0)
Dim dt As DateTime = DateTime.Now()
objCookie = New HttpCookie("cookie1", "value1")
objCookie.Expires = dt.Add(ts)
Response.Cookies.Add(objCookie)
==========
Thanks in advance,
Ben