Here is a cookie wrapper I had:
public static void SetCookieValue(Page p, string cookieName, string
cookieValue, string subKey, TimeSpan expiresTimeSpan)
{
bool subKeyWasSupplied = false;
if (null != subKey)
{
if (subKey.Length 0)
{
subKeyWasSupplied = true;
}
}
_currentTimeSpan = expiresTimeSpan;
if (p.Request.Cookies[cookieName] == null)
{
CreateCookie(p, cookieName);
}
HttpCookie aCookie = p.Request.Cookies[cookieName];
if (subKeyWasSupplied)
{
aCookie.Values[subKey] = cookieValue;
}
else
{
aCookie.Value = cookieValue;
}
aCookie.Expires = DateTime.Now.Add(_currentTimeSpan);
p.Response.Cookies.Add(aCookie);
}
<Da**************@gmail.comwrote in message
news:11*********************@n76g2000hsh.googlegro ups.com...
Hi everyone
I'm using v 2.0 of the framework with C# and am developing a web
application.
I am finding that my cookie names are duplicating themselves over and
over again, for example when I write out all the cookie keys and
values, I am getting the following:
CookieA: Apple
CookieB: Banana
CookieC: Carrott
CookieA: Apple
CookieB: Banana
CookieC: Carrott
I don't understand why this is happening - but I feel there may be
some of you out there that know exactly what has caused this
problem... or at least I hope!
Any pointers are most appreciated.
Many thanks
Darren