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
%>
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!