http://www.bc-cn.net/bbs/dispbbs.asp?boardID=113&ID=60997&page=1
第二楼
我用vb写了个记数器,是通过StreamReader 和Streamwriter对.txt文件进行读写数,再以图形方式显示能实现服务器关闭后其计算值不会消失 代码如下
Dim objReader As New System.IO.StreamReader(Server.MapPath("counter.txt"))
Dim counter As Long = objReader.ReadLine()
objReader.Close()
If Session.IsNewSession = True Then
counter = counter + 1
Dim objwriter As New System.IO.StreamWriter(Server.MapPath("counter.txt"), False)
objwriter.WriteLine(counter.ToString())
objwriter.Close()
End If
Dim i As Byte, ICounter As String
For i = 1 To Len(counter.ToString())
ICounter = ICounter & "<img src=digit" & Mid(counter, i, 1) & ".gif>"
Next
mycounter.Text = "你是第" & ICounter & "位访问者"
lastvisittime.Text = "最新一次浏览时间:" & System.DateTime.Now()