asp中如何创建与读取cookie的值?

2024-12-18 13:58:13
推荐回答(2个)
回答1:

赋值
Response.Cookies("letwego")("visiter")="84ww" '赋值
Response.Cookies("letwego").Expires= (now()+7) '设置过期时间(7天)
userName=Request.Cookies("letwego")("visiter") '取Cookies
Response.Cookies("letwego").Expires= (now()-1) '删除Cookies,设置过期时间(-1天)

'dateadd("n",30,now()) 得到分钟
'dateadd("S",30,now()) 得到秒
读取
Response.Cookies("visiter")="aaa"
a=Request.Cookies("visiter")
Response.Cookies("letwego")("visiter")="aaa"
a=Request.Cookies("letwego")("visiter")

回答2:

response.Cookies("cookiename")="abc" 赋值

textbox1=request.Cookies("cookiename") 取值