----------------------------------------------------------------------------------------------------------------------------------------------- 本文提示:《如何用ASP创建日志文件》是本站编辑们为广大网友精选的实用文章,本文阐述了关于文章的相关理论,相对来说专业性强,但是本文只是针对于某个问题提出的见解与论述,未必能辐射到相关问题的方方面面,所以本文处理问题的方法仅仅为您提供一些参考。更多问题请查阅学习中国网其他栏目哦. ----------------------------------------------------------------------------------------------------------------------------------------------- 你是否有时想知道什么人访问你的站点,什么时间,IP地址等。下面我就这个问题向大家来阐述一下。这个例子使用文本文件来写入用户的信息创建一个logfile.asp放在每一个asp的页面的顶端<!--#Include File="LogFile.asp"-->当有人来访问你的站点logfile.asp自动把他的信息写入LogFile.txt,如果相关的URl一样的话则不写入文件
File: LogFile.asp
<%
Dim ValidEntry ' Log variable
' First set that this log is valid
ValidEntry = True
' If Session Variable "LogIn" is not empty
' that mean this person has already been logged
' then set ValidLog to False
If not IsEmpty(Session("LogIn")) then ValidEntry = False
' Here you can add different restriction
' If the refering url is from same site
' don't write to log file
If Left(Request.ServerVariables("HTTP_REFERER"), 17)="http://devasp.com" Then
ValidEntry = False
End if
If Left(Request.ServerVariables("HTTP_REFERER"), 21)="http://www.devasp.com" Then
ValidEntry = False
End If
' Now if ValidEntry is True then enter to log file
本文章更多内容:1 - 2 - 下一页>>收藏到:[收藏夹] [百度搜藏] [新浪ViVi] [POCO网摘] [ 和讯网摘] [好哦网摘] [Google书签] [Yahoo书签] [搜狐网摘] [365Key网摘] [天极网摘] [我摘] [博采网摘] [igooi网摘] |