Klarade millennium-buggen
|
|
Reg.datum: Apr 2006
Inlägg: 2 126
|
|
Klarade millennium-buggen
Reg.datum: Apr 2006
Inlägg: 2 126
|
Citat:
You cannot directly modify a cookie. Instead, changing a cookie consists of creating a new cookie with new values and then sending the cookie to the browser to overwrite the old version on the client. The following code example shows how you can change the value of a cookie that stores a count of the user's visits to the site:
Kod:
int counter;
if (Request.Cookies["counter"] == null)
counter = 0;
else
{
counter = int.Parse(Request.Cookies["counter"].Value);
}
counter++;
Response.Cookies["counter"].Value = counter.ToString();
Response.Cookies["counter"].Expires = DateTime.Now.AddDays(1);
|
http://technet.microsoft.com/en-us/l...94(VS.80).aspx
|