devxlogo

Make Your Cookies Live Longer

Make Your Cookies Live Longer

When using ASP to create browser cookies, by default the cookie is alive only as long as the browser is running. You can make cookies last longer by defining an expiration date at the same time you bake the cookie. Note that since the user might be anywhere on the globe, the convention is to use UNC time. The following code sets a cookie that expires on leap day, in the year 2000:

 <%Response.Cookies("chocolate") = "an ASP morsel"Response.Cookies("chocolate").expires = #2/29/2000#%>
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist