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

ASP
用XML数据岛解决用户界面问题 - 1
用XML数据岛解决用户界面问题 - 2
用XML数据岛解决用户界面问题 - 3
关于ASP中堆栈溢出错误的解决
运用asp结合vbscript模拟股票滚屏
如何在VC++ 编写的组件中使用 ADO
VBSctipt 5.0中的新特性
ASP.NET中使用多个runat=server form
ASP.NET中的XML表单控件
页面之间传递元素的办法
转换文本为超联和Email格式的代码
vbscript和javascript互相调用
用VB6创建MTS组件
连接各种数据库的代码的总结
数据排序及如何动态排序
将HTML表单数据存储为XML格式
关于打印页面的一些经验
用vbscript判断email地址的合法性
可以近视替代remote script的代码
利用MSCHART画图的一段代码

ASP 中的 使用Cookie来跟踪用户


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 37 ::
收藏到网摘: 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-