testCookies.asp
' 检查浏览器是否接受Cookies.
<%
strTest = Request.QueryString("CookieTest")
If UCase(strTest) <> Ucase("true") Then
Session("__FlashCookieTest") = True
' 第一次呼叫.设置session变量.
' 用QueryString重定向.
strURL = Request.ServerVariables("script_NAME")
strQueryString = "?CookieTest=true"
Response.Redirect(strURL & strQueryString)
Response.End
Else
If Session("__FlashCookieTest") = True Then
' 已完成重定向.检查session变量是否包含值.
strOut = "Cookies=true"
' Session变量包含值,因此浏览器接受Cookies.
Else
strOut = "Cookies=false"
' Session变量为空,浏览器决绝Cookies.
End If
End If
Response.Write(strOut)
' 输出到Flash.
%>
setCookies.asp
<%
For each item in Request.QueryString
Response.Cookies(item) = Request.Querystring(item)
Next
%>
getCookies.asp
' 读取 Cookies
<%
For each Cookie in Request.Cookies
strOut = strOut & Server.URLEncode(Cookie) & "="
strOut = strOut & Server.URLEncode(Request.Cookies(Cookie))
strOut = strOut & "&"
Next
Response.Write strOut
%>
新闻热点
疑难解答