Submit a Site

 


Settign a cookie in ASP

November 25th, 2007 | by valiik |

Use the Expiration line of code if you want the cookie to last globaly throughout all the browser windows. If you do not include the Expiration line and just use the one Response.Cookie(”blownies”) - “something” line the cookie will only last in this specific window until it is closed.

‘create a 10-day cookie

Response.Cookies(”brownies”) = 13Response.Cookies(”brownies”).Expires = Date() + 10

‘create a static date cookie

Response.Cookies(”name”) = “Suzy Q.”Response.Cookies(”name”).Expires = #January 1,2009#

‘you can also specify domain if going from a http to https.

Response.Cookies(”brownies”).Domain = “domain.com”

Post a Comment