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
注:更多精彩教程請關注三聯網頁設計教程 欄目,