Monday, March 22, 2010

How to Create a Cookie?

The "Response.Cookies" command is used to create cookies.
Note: The Response.Cookies command must appear BEFORE the tag.
In the example below, we will create a cookie named "firstname" and assign the value "Alex" to it:
<% Response.Cookies("firstname")="Alex" %>
It is also possible to assign properties to a cookie, like setting a date when the cookie should expire:
<% Response.Cookies("firstname")="Alex" Response.Cookies("firstname").Expires=#May 10,2012# %>