Deleting Cookies

G

Guest

Hi all,
Environment : ASP.NET
I am using cookies to store some data. this is done in a class which is
called by a web page CookieCreate.aspx. Here is a little bit of code of how i
create the cookie in the class


Dim context As HttpContext = HttpContext.Current

If Not context.Request.Cookies("CartID") Is Nothing Then

Return context.Request.Cookies("CartID").Value

Else

' Generate a new random GUID using System.Guid Class
Dim tempCartId As Guid = Guid.NewGuid()
context.Response.Cookies("CartID").Value =
tempCartId.ToString()

End If


Now when i want to delete this cookie in another page which is
CookieDelete.aspx i am not able to do it, the code that i am using to delete
it is

Session.Clear()
HttpContext.Current.Request.Cookies.Clear()
HttpContext.Current.Items.Clear()

i was thinking one of them shold delete all the cookies that my other
webpage might have opened but it is not, so the questions is how can i delete
a cookie from page B when page A or any other page has create it?

thanks
sameer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top