PDA

View Full Version : remove cookies



fafan_iran
چهارشنبه 21 تیر 1385, 13:26 عصر
با سلام
من در asp.net از cookiesاستفاده کردم . ولی موفق به remove آنها نمی شوم . من از دستورات زیر نیز استفاده کرده ام
Cookies.Remove

Dim objCookie As HttpCookie
objCookie = New HttpCookie("strKeyCode")

objCookie.Expires = DateTime.Today.AddYears(-1)

Response.AppendCookie(objCookie)
و همینطور
objCookie.Expires = Now
و
Response.Cookies.Item("strKeyCode").Expires = Now و objCookie = Nothing و

وResponse.Cookies("strKeyCode").Expires = DateTime.Now.AddYears(-30)

لطفا کمک کنیدددددددددددددد.
با تشکر

monster_ant
شنبه 14 مرداد 1385, 09:04 صبح
مرجع msdn:


You cannot directly delete a cookie on a user's computer. However, you can direct the user's browser to delete the cookie by setting the cookie's expiration date to a past date. The next time a user makes a request to a page within the domain or path that set the cookie, the browser will determine that the cookie has expired and remove it.

monster_ant
شنبه 14 مرداد 1385, 09:10 صبح
و دیگه اینکه :

Calling the Remove method of the Cookies collection removes the cookie from the collection on the server side, so the cookie will not be sent to the client. However, the method does not remove the cookie from the client if it already exists there.