通过FSO进行页面计数

作者:cnbruce 来源:cnbruce博客 时间:2008-11-27 16:02:00 

 

<%
Function FileCounter(counter_file)
Dim fs,txt,file
Application.lock
Set fs=Server.CreateObject("Scripting.FileSystemObject")
file=Server.MapPath(counter_file)

Set txt=fs.OpenTextFile(file,1,true)
if Not txt.atEndOfStream then
FileCounter=CLng(txt.ReadLine)
End if
FileCounter=FileCounter+1
txt.Close

On Error Resume Next
Set txt=fs.CreateTextFile(file,True)
if Err.Number=70 then
FileCounter="请先将"&file&"的只读属性去掉!"
ElseIf Err.Number<>0 then
FileCounter=Err.Description
else
txt.writeLine FileCounter
txt.close
End if
Application.Unlock
End function
%>

<%=FileCounter("num.txt")%>
标签:fso,计数,统计
0
投稿

猜你喜欢

  • 内容页页码的预览导航

    2008-07-07 16:43:00
  • Qzoneing主题视觉设计分享

    2009-07-21 18:12:00
  • asp下用OracleInProcServer完成对Oracle的连接和操作

    2008-04-13 07:10:00
  • 從無到有實現一個xml數據庫登錄驗証

    2008-09-05 17:12:00
  • ASP使用缓存方法及缓存类详解

    2008-02-15 08:36:00
  • 像懒人一样去设计

    2009-04-23 12:43:00
  • ASP.NET 2.0中Gridview控件高级技巧图文教程

    2007-08-07 15:46:00
  • 不完全HTML在线编辑器收集

    2007-11-08 12:20:00
  • 设计师和美工

    2008-10-27 13:43:00
  • 对mysql表进行优化、分析、检查和修复的说明

    2010-04-22 16:28:00
  • 开发心得--写给想学Javascript朋友的一点经验之谈

    2009-02-25 11:42:00
  • SQL提供的进行数据传输的实用程序—BCP

    2009-01-23 13:45:00
  • 互联网产品设计师自我介绍

    2009-04-16 12:45:00
  • Ajax+asp应用实例 注册模块,表单提交

    2011-04-08 10:47:00
  • DIV+CSS高度自适应网页代码实例

    2008-09-20 08:00:00
  • OL IE Bug

    2009-09-09 16:25:00
  • SQL存储过程介绍

    2008-02-13 18:52:00
  • WAP页面设计与实现小贴士

    2011-01-10 20:38:00
  • 适宜做简单搜索的MySQL数据库全文索引

    2009-01-04 13:11:00
  • asp版FCKEditor编辑器的用法

    2008-07-05 12:15:00
  • asp之家 网络编程 m.aspxhome.com