Request. Cookies. Clear () is not used to delete cookies.
Deleting a cookie (that is, physically removing a cookie from a user's hard disk) is a form of cookie modification.
The cookie cannot be directly removed because it is on the user's computer.
However, the browser can delete cookies for you.
This technology creates a new cookie with the same name as the cookie to be deleted,
Set the cookie expiration date to a date earlier than the current date.
When the browser checks the cookie expiration date, the browser will discard the expired cookie.
The followingCodeExample: delete an applicationProgramOne method for all available cookies in:Copy codeThe Code is as follows: 1. httpcookie acookie;
2. String cookiename;
3. Int Limit = request. Cookies. count;
4. For (INT I = 0; I <limit; I ++)
5 .{
6. cookiename = request. Cookies [I]. Name;
7. acookie = new httpcookie (cookiename );
8. acookie. expires = datetime. Now. adddays (-1 );
9. response. Cookies. Add (acookie );
10 .}