Howdy
I'm using these two functions I got off the web for cookies, but with a
problem:
public bool SetCookie(string cookiename, string cookievalue ,int
iDaysToExpire)
{
try{
HttpCookie objCookie = new HttpCookie(cookiename);
Response.Cookies.Clear();
Response.Cookies.Add(objCookie);
objCookie.Values.Add(cookiename,cookievalue);
DateTime dtExpiry = DateTime.Now.AddDays(iDaysToExpire);
Response.Cookies[cookiename].Expires =dtExpiry;
}
catch( Exception e){
return false;
}
return true;
}
public string GetCookie(string cookiename){
string cookyval="";
try{
cookyval= Request.Cookies[cookiename].Value;
}
catch(Exception e){
cookyval="";
}
return cookyval;
}
Howdy, if I set a cookie via say SetCookie("username", "test" ,30)
and then try to get the value using GetCookie("username")
the value returned is username=test
when I actually just want test.
How do I get this, or what am I doing wrong?
Thanks
Matt