Home
Developer Blog
Ajax effects
CSS examples
Freelance jobs
Hot IT Jobs
Hot scripts
Code samples
Web hosting directory
Lotus Notes FAQ
See the new scripts recently added to Dynamic Drive.
Click here
.
Original, practical
CSS codes and examples
such as CSS menus for your site.
Search code samples
Keyword
All Categories
ASP
CSS
Dhtml
Html
Javascript
PHP
Code Samples
ASP
CSS
Dhtml
Html
Javascript
PHP
LOGIN HERE
Username
Password
Signup Now
Forgot Password
Verify Signup
ASP >> Cookies
How do I set a cookie?
Visitor Ratings (0) :
Description
Cookies are implemented as a collection in the ASP Response object, so you merely specify the name of the item in that collection and set it's value :
Code
Select All
<% ' SET A TEXT STRING Response.Cookies("myCookie") = "this value" ' SET THE RETURN OF A FUNCTION Response.Cookies("myCookie2") = Now() %> Returning them is also easy: <% Response.Write Request.Cookies("myCookie") & "<br>" Response.Write Request.Cookies("myCookie2") %> Alternately, if you are setting LOTS of cookies, you can use the fact that they are in a collection to return them all: <% ' cookie IS JUST AN ARBITRARY VARIABLE NAME For each cookie in Request.Cookies Response.Write cookie & " = " & Request.Cookies(cookie) & "<br>" Next %>
Rate this Resource
0
1
2
3
4
5
6
7
8
9
10