asp Cookies 写入与清除cookies程序
asp教程 Cookies 写入与清除cookies程序
'****************************************************
'函数名:ResponseCookies
'作 用:写入COOKIES
'参 数:Key ----cookie名
' value ----cookie值
' expires ---- cookie过期时间
'****************************************************
Public Function ResponseCookies(Key,Value,Expires)
DomainPath=Left(Request.ServerVariables("script_name"),inStrRev(Request.ServerVariables("script_name"),"/"))
Response.Cookies(Key)=""&Value&""
if Expires<>0 then Response.Cookies(Key).Expires=date+Expires
Response.Cookies(Key).Path=DomainPath
End Function
'****************************************************
'函数名:CleanCookies
'作 用:清除COOKIES
'****************************************************
Public Function CleanCookies()
DomainPath=Left(Request.ServerVariables("script_name"),inStrRev(Request.ServerVariables("script_name"),"/"))
For Each objCookie In Request.Cookies
Response.Cookies(objCookie)= ""
Response.Cookies(objCookie).Path=DomainPath
Next
End Function
' cookies使用方法
ResponseCookies("zzzyk.com教程","zhaoxi",date())'设置cookies
CleanCookies() '清除cookis
补充:asp教程,高级应用