Open In App

ASP Response.Cookies Collection

Basically Cookies are small files which are stored on a user’s computer. It is used to hold a modest amount of data specific to a particular client and website and can be accessed either by the web server or by the client computer.  

The Response.Cookies Collection is used for setting the value of collection of the cookies.If the specified cookie does not exist, it is created. If the cookie exists, it takes the new value, and the old value is discarded. 



Syntax:   

Response.Cookies(name)[(key)|.attribute]=value

Parameters:



Example 1: Below code illustrates how to create cookies having named “website” and assigned the value “GeeksForGeeks” to it. 




<%
Response.Cookies("website")="GeeksForGeeks"
%>

Example 2: Below example demonstrate how you can set a value for a cookie and assign values to its attributes.




<%  
 Response.Cookies("Type") = "fruits"  
 Response.Cookies("Type").Expires = "July 31, 2001"  
 Response.Cookies("Type").Path = "/"  
%>

Article Tags :