Hey guys i get this error when i try to assign CartID to a string. Would really appreciate any help. Thanks
private static string CartID
{
get
{
HttpContext cont = HttpContext.Current;
string id = cont.Request.Cookies["ShopCartID"].Value;
if (cont.Request.Cookies["ShopCartID"] != null)
{
return id;
}
else
{
id = Guid.NewGuid().ToString();
HttpCookie cookie = new HttpCookie("ShopCartID", id);
int days = 7;
DateTime currentDate = DateTime.Now;
TimeSpan timeSpan = new TimeSpan(days, 0, 0, 0);
DateTime expiration = currentDate.Add(timeSpan);
cookie.Expires = expiration;
cont.Response.Cookies.Add(cookie);
return id.ToString();
}
}
}