'Dim visitNumber As Long '定义计数器变量
' Dim myfile As String = Server.MapPath("counter2.txt") '定义文件路径变量
'Dim sw As StreamWriter '声明StreamWriter对象变量
'Dim sr As StreamReader '声明StreamReader对象变量
' If File.Exists(myfile) = False Then
'如果该文件不存在,就建立文件,并写入1。
' sw = New StreamWriter(myfile, False)
'sw.WriteLine("1") '写入1
'sw.Close()
'message1.Text = "您是第1位访客"
'Else
'读取文本文件
' sr = New StreamReader(myfile)
' visitNumber = CLng(sr.ReadLine()) '读取1行,并转化成长整型
' sr.Close()
'写入文本文件
' sw = New StreamWriter(myfile, False)
' visitNumber = visitNumber + 1 '将总数加1
' sw.WriteLine(visitNumber.ToString()) '写入1行,覆盖原有数据
' sw.Close()
'End If
' message1.Text = "您是第" & visitNumber & "位访客"
admin.Text = Session("username")