欢迎光临
我们一直在努力

使用cookie来跟踪用户_asp技巧

建站超值云服务器,限时71元/月

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 dont, the cookie will
*** expire when the user closes their
*** browser, and youll lose all info.
Response.Cookies("asphole").Expires = "January 1, 2020"

%>

-END-

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 使用cookie来跟踪用户_asp技巧
分享到: 更多 (0)

相关推荐

  • 暂无文章