Link to home
Create AccountLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

vb.net Delete cookie 1 minute after its creation

Hello All.

I need to delete a cookie 1 minute after it has been created.
I have two different types of cookies being created I need this done too.

First

HttpContext.Current.Response.Cookies.Set(New HttpCookie("theACookie", rs("AID")))

Open in new window


Second

Dim shortTime As String = Now.ToString("mm") + Now.ToString("ss") + Now.ToString("fff")
' -- Cookie with Time added to the CookieName

HttpContext.Current.Response.Cookies.Set(New HttpCookie("theBCookie" + shortTime, rs("BID")))

Open in new window


These cookies are created during an Upload.

Once the upload is done, the cookies need to be deleted.

There are about 20+ cookies created in each upload, and after this process is done several times, my Login cookie gets deleted, as the cookies are full in Google Chrome.


So, deleting the cookies that are no longer needed is the best way to deal with this issue.

I am already deleting the ASPSESSION cookies, due to this same limit on cookies issue.


Thank you.
Wayne




ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Wayne Barron

ASKER

As always, thanks Gonzo.
The issue was, that I had never messed with the AddSeconds or AddMinutes, so I did not know about them, until today. The AddMinutes I found out from your post.

Thank you.