·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 使用COOKIE来跟踪用户

使用COOKIE来跟踪用户

类别: ASP教程  评论数:0 总得分:0
<%

\'*** Keeping track of how many times
\'*** a user visits a web page, by
\'*** reading and writing cookies.

\'*** In this example "asphole" will be
\'*** the name of our cookie, and
\'*** "totalvisit" will be the \'key\'
\'*** value we keep track of. You can
\'*** have multiple \'keys\' for each
\'*** cookie.

\'*** Declare your variables
Dim NumVisit

\'*** Check to see how many times they
\'*** have been to your web page.
NumVisit = Request.Cookies("asphole")("totalvisit")

\'*** If this is their first visit to
\'*** the page NumVisit is blank, so
\'*** make the value of NumVisit 0.
If NumVisit = "" Then
NumVisit = 0
End If

\'*** Display how many times they have
\'*** visited your web page.
Response.Write "Visits to this page: " & NumVisit

\'*** Count the visit to the web page
NumVisit = NumVisit + 1

\'*** Write the new total back to
\'*** the cookie in their browser
Response.Cookies("asphole")("totalvisit") = NumVisit

\'*** Specify when the cookie expires.
\'*** If you don\'t, the cookie will
\'*** expire when the user closes their
\'*** browser, and you\'ll lose all info.
Response.Cookies("asphole").Expires = "January 1, 2020"

%>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1