• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> ASP开发 >> ASP应用 >> 详细内容
 

推荐文章

 
 

热点文章

  • ASP计算汉字笔画程序代码
  • 身份证查询的ASP版Ajax服务器端,不需要数据库支持
  • ASP入门教程(留言板)
  • ASP小偷程序的原理
  • 用文本+ASP打造新闻发布系统/图片上传
  • 超级留言本制作实例
  • ASP实现的日历,可以根据需要在日期上添加任何的操作
  • 利用ADODB.Stream使用浏览器下载服务器文件
  • Asp深度揭密
  • t0nsha's留言板代码
  • 无组件上传图片到数据库中,最完整解决方案
  • ASP操作Excel技术总结
 
 

相关文章

  • 国内ASP应用,不容乐观
  • 用ASP创建多栏选项列表
  • 用户状态维护
  • ASP3.0中的流控制能力
  • session的几个问题
  • 分页显示的例子(显示记录背景色替换变化)
  • 编写ASP时用JScript好还是用VBScript好?
  • 域名登记查询(whois)很复杂吗
  • LINE9的目录浏览源程序
  • 谈谈对于ASP+ PDC bits的经验
  • 浅析数据完整性问题
  • 下载文件的代码
 
 

百度搜索

 
 

如何用ASP创建日志文件

  • 阅览次数:
  • 文章来源: 网海之贝
  • 原文作者: 佚名
  • 整理日期: 2006-10-03
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

你是否有时想知道什么人访问你的站点,什么时间,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
If ValidEntry Then
Const ForAppending = 8
Const Create = true
Dim FSO
DIM TS
DIM MyFileName
Dim strLog

MyFileName = Server.MapPath("MyLogFile.txt")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)

' Store all required values in strLog
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>"
' Write current information to Log Text File.
TS.write strLog
TS.Writeline ""
' Create a session varialbe to check next time for ValidEntry
Session("LogIn") = "yes"
Set TS = Nothing
Set FSO = Nothing
End If
%>  

上一篇:Asp深度揭密
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号