Do I need to delete my cookie before re-adding it?
From: Ben Amada (ben_at_REpoMOweVErpick.com)
Date: 02/16/04
- Next message: Mircea Pleteriu: "Endless session"
- Previous message: Anton ml. Vaheie: "file access (probably n-time) - forms"
- Next in thread: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Reply: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Reply: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 16 Feb 2004 05:08:31 -0700
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
- Next message: Mircea Pleteriu: "Endless session"
- Previous message: Anton ml. Vaheie: "file access (probably n-time) - forms"
- Next in thread: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Reply: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Reply: .NET Follower: "Re: Do I need to delete my cookie before re-adding it?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|