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