The default cookie expiration time is until you close the browser, the cookie expires, or you can specify the cookie time.
Response.Cookies ("user_name"). Expires=date+1 ' Specify cookie save time
Keep cookies for one hours
Response.Cookies ("MyCookie"). Expires= (now () +1/24) response.cookies ("MyCookie"). Expires = DATEADD ("h", 1, Now ())
Set to expire after 60 months
Response.Cookies ("CookieName"). Expires=dateadd ("M", 60,now ())
Response.Cookies ("User"). Expires=second () +7
The time defined after expires can be replaced with a time function
For example: Date () +7 means adding 7 days to today's time, while second () +7 is 7 seconds. Response.Cookies ("field name"). expires= time function +n, for example: Response.Cookies ("name2"). Expires=date+1, which means that Cookies are kept for 1 days, for example: Response.Cookies ("Name2"). Expires=hour+8, which means that the Cookies are kept for 8 hours. I have tested this method (in 2003server,iis6.0), no matter if there is no add () behind the second, there will be a 500 error on access (or the page cannot be displayed?). Forget it). Weaving dream Juve: Here is the time to add the suggestion or use the DATEADD function, for example, we have to accumulate an hour, then use: Response.Cookies ("baidooglecom"). Expires = DATEADD ("h", 1, Now ()) 30 minutes: Response.Cookies ("CookieName"). Expires=dateadd ("n", 30,now ()) DateAdd ("s", 30,now ()) Gets the seconds Expires the expiration date of the specified cookie. In order to store the cookie on the client disk after the session ends, or in many cases, we want to save the cookie on the visitor's computer for a longer period of time. The date must be set. If the setting for this property does not exceed the current date,
The cookie expires at the end of the task. The expiry time of the cookie is "January 1, 2010":
Response.Cookies ("CookieName"). expires= #January, 2010# cookie expires at "Cookie creation time + 365 days": Response.Cookies ("CookieName"). expires=date+365 but it is best not to write Response.Cookies ("CookieName") casually. Expires=date, so that the call value between pages is empty.
Function Killip (cook,cooktime) ' Block IP, the same IP cannot be executed multiple times (cookie name, cookie time) Killip ("Queip", () Cook = Checkstr (Cook) If not Isint (cooktime) Then Response.Write "Cooktime was not int" Exit function End if request. Cookies (Cook) & "<>" and request. Cookies (Cook) & "= GetIP () then ExecScript" alert (' Sorry, the same IP cannot be manipulated multiple times. '); location.href= '/'; "Response. End End If Response.Cookies (Cook) = GetIP () response.cookies (Cook). Expires=dateadd ("n", Cooktime,now ()) ' How many minutes. DATEADD ("S", 30,now ()) 30 seconds. Date+1 1 days. End Function
Call Killip ("Queip", 30)