如何在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
%>
上一篇: 如何正确显示数据库里同时存在的GB码和BIG5码?
下一篇: 如何验证字符串是否包含有效字符?