Dim strcookie, strTry
strcookie = Request.cookies("Mycookie")
strTry = Request.QueryString("Try")
If strcookie = "" Then
' 检测否是设置了cookie.
If strTry = "" Then
Response.cookies("Mycookie") = "Set"
' 重定向到这一页面再试.
Response.Redirect(Request.ServerVariables("script_NAME")
& "?Try=Yes")
Else
' 如果没有开启cookie.
End If
Else
' 客户端正在接受cookie.
Response.cookies("Mycookie").Expires = "April 15, 2001"
End If
注:更多精彩教程请关注山村网页设计教程 栏目,