当前位置:编程学习 > asp >>

如何在Flash中处理Cookies?

答案:

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

%>

上一个:如何在ASP中恰当地运用Cookies?
下一个:如何决定是否将登录内容保存到Cookie里?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,