scm0sml
asked on
checking for an existing cookie
Hi,
I have the following code:
if (Response.Cookies["888"] == null)
{
aCookie = new HttpCookie("888");
aCookie.Value = System.Guid.NewGuid().ToSt ring();
aCookie.Expires = DateTime.Now.AddDays(7);
Response.Cookies.Add(aCook ie);
I've just used a dummy name 888 for now but I'm trying to check to see if a cookie exists and if not create it.
However the code above always gets stepped over, even when the cookie shouldn't exist.
Am I doing the correct check?
Thanks
I have the following code:
if (Response.Cookies["888"] == null)
{
aCookie = new HttpCookie("888");
aCookie.Value = System.Guid.NewGuid().ToSt
aCookie.Expires = DateTime.Now.AddDays(7);
Response.Cookies.Add(aCook
I've just used a dummy name 888 for now but I'm trying to check to see if a cookie exists and if not create it.
However the code above always gets stepped over, even when the cookie shouldn't exist.
Am I doing the correct check?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.