当前位置: 首页 > 图文教程 > 网络编程 > ASP > 使用Cookie来跟踪用户

ASP
对连串英文自动换行的解决方法 IE5.5
怎样写你自己的EMAIL组件(原理)
ASP中有关timeout超时的体会
用ASP实现从SQL Server导出数据到Access
ASP向NT域中加一个用户
ASP乱码的解决方法
关于 aspsmartupload 注册问题
利用XML不离开页面刷新数据
IIS 处理 SEARCH 请求漏洞
不用组件实现上载功能(1)
不用组件实现上载功能(2)
在网页中实现OICQ里的头像选择的下拉框
仅用xsl和asp实现分页功能
如何使用context()方法将数据置入表格(XML)
利用ASP从远程服务器上接收XML数据
将数据库里面的内容生成EXCEL
怎样在ASP里面创建统计图表
加密你的Access数据库
利用global.asp定时执行ASP
加密QueryString数据

ASP 中的 使用Cookie来跟踪用户


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 40 ::
收藏到网摘: n/a

  Source Code:



<%

'*** 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"

%>




-END-