Cookies in Classic ASP

Last updated: August 27, 2026.

Read cookies through Request.Cookies and write them through Response.Cookies.

<%
Response.Cookies("preferences")("theme") = "dark"
Response.Cookies("preferences").Expires = DateAdd("d", 30, Now())
Dim theme
theme = Request.Cookies("preferences")("theme")
If theme <> "dark" And theme <> "light" Then theme = "light"
Response.Write Server.HTMLEncode(theme)
%>
ControlPurpose
SecureHTTPS only.
HttpOnlyBlocks script access to authentication cookies.
SameSiteReduces cross-site request risk.
Short lifetimeLimits exposure.

Apply missing modern attributes through a tested header or server configuration strategy. Never store passwords in cookies.

admin

admin

Leave a Reply

Your email address will not be published.