Cookies are used to store data on your computer by a Web browser.
When a browser connects to an account on a Web site and select a "remember me" check box, for example, a cookie is used to remember account information to the user. In contrast to the session timeout, and disconnect the user cookies, to stay until they expire and are deleted on the client computer. Difficulty: averageInstructionsThings you will need: Visual Studio .NET 2005 (2008)- 1
Create a cookie.
To remove a cookie, there must be. Everything you need create a cookie that is a call to the class, the name of the cookie and the data that you want to save. - 1
Create a cookie.
EHowCookie HttpCookie = new HttpCookie ("Hello");
eHowCookie.Value = "say hello".
Add (eHowCookie).
Make sure that the cookie exists.
HttpCookie cookie = request.cookies ["Hello"].
Delete the cookie.
Response.cookies ["Hello"] .expires = DateTime.Now.AddDays;
If you have set multiple cookies, you can delete all cookies from each one of you passes through.
String [] site cookies = Request.Cookies.AllKeys;
Foreach (string cookie in site cookies)
{
Response.cookies [cookie] .expires = DateTime.Now.AddDays;
}
Delete a cookie automatis
Response.cookies ["Hello"] .expires = DateTime.Now.AddDays (+ 5);
No comments:
Post a Comment