asp如何准确获知对方来访问的时间和URL?

时间:2010-07-07 12:25:00 

如何准确获知对方来访问的时间和URL?

代码如下:

logfile.asp

<%
Dim ValidLog 
' 设置日志变量
ValidEntry = True
If not IsEmpty(Session("LogIn")) then ValidEntry = False
' 如果 LogIn 不为空,表明用户信息已经写进
If Left(Request.ServerVariables("HTTP_REFERER"), 17)="http://aspxhome.com" Then 
  ValidEntry = False
End if
If Left(Request.ServerVariables("HTTP_REFERER"), 21)="http://www.aspxhome.com" Then
  ValidEntry = False
' 如果访问的是同一个URL,则不写进日志文件
End If
If ValidEntry Then  
  Const ForAppending = 8
  Const Create = true
  Dim FSO
  DIM TS
  DIM MyFileName
  Dim strLog
' 如果ValidEntry为真,则写进日志文件
  Set FSO = Server.CreateObject("Scripting.FileSystemObject")
  Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)
   
  strLog = "<br><P><B>" & now & "</B> "
  strLog = strLog & Request.ServerVariables("REMOTE_ADDR") & " "
  strLog = strLog & Request.ServerVariables("HTTP_REFERER") & " "
  strLog = strLog & Request.ServerVariables("HTTP_USER_AGENT") 
  ' 保存信息
& "<BR>"
  TS.write strLog
  TS.Writeline ""
' 把当前的信息写进文本文件里面
  Session("LogIn") = "yes"
' 创建一个session变量,用于检查下次ValidEntry的值
  Set TS = Nothing
  Set FSO = Nothing
End If
%>

标签:url,来源,asp
0
投稿

猜你喜欢

  • JavaScript面向对象的简单介绍

    2008-06-27 12:37:00
  • 10分钟学会Google Map API (二)

    2009-06-07 18:14:00
  • MySQL的性能调优工具:比mysqlreport更方便的tuning-primer.sh

    2008-12-08 08:37:00
  • 10分钟学会Google Map API (一)

    2009-06-07 18:17:00
  • 谈谈我的“分离”观

    2010-08-31 14:47:00
  • SQL Server中两种修改对象所有者的方法

    2009-01-15 13:10:00
  • 一个用Ajax做的用户名验证程序

    2007-10-21 20:40:00
  • 如何查询日期类型的数据?

    2009-11-11 20:04:00
  • 让ExtJs的combobox不显示HTML……

    2009-05-31 17:01:00
  • Yahoo!网站性能最佳体验的34条黄金守则——图片、Coockie与移动应用

    2008-05-29 13:44:00
  • 深入研究ASP中的Session

    2007-09-13 12:37:00
  • Windows存储 SQL行溢出 差异备份及疑问

    2008-12-24 15:22:00
  • css样式命名规则

    2008-04-30 12:31:00
  • SQL Server 2005中数据库镜像的四个问题

    2009-02-19 16:48:00
  • ASP 千万级数据分页的存储过程

    2011-04-14 11:08:00
  • JavaScript 各种动画渐变效果

    2008-09-02 10:38:00
  • asp生成不需要数据库的中奖码

    2008-07-18 12:31:00
  • Dreamweaver量身打造Wordpress留言板(二)

    2009-12-12 17:35:00
  • SQL Server从安装到建库为新手寻找捷径

    2009-01-13 13:22:00
  • SQL文本字段的数字排序问题

    2008-11-18 16:47:00
  • asp之家 网络编程 m.aspxhome.com