主题:[讨论]asp.net防刷新记数器问题
[em7]Sub page_load()
Dim objreader As New StreamReader(Server.MapPath("1.txt"))
Dim count As String = objreader.ReadLine()
objreader.Close()
If Session.IsNewSession = True Then
count += 1
Dim objwriter As New StreamWriter(Server.MapPath("1.txt"), False)
objwriter.WriteLine(count)
objwriter.Close()
End If
Response.Write(count)
End Sub
这个程序用了If Session.IsNewSession = True 来判断用户是否刷新,但运行是为什么点了刷新数字还是不断提升
Dim objreader As New StreamReader(Server.MapPath("1.txt"))
Dim count As String = objreader.ReadLine()
objreader.Close()
If Session.IsNewSession = True Then
count += 1
Dim objwriter As New StreamWriter(Server.MapPath("1.txt"), False)
objwriter.WriteLine(count)
objwriter.Close()
End If
Response.Write(count)
End Sub
这个程序用了If Session.IsNewSession = True 来判断用户是否刷新,但运行是为什么点了刷新数字还是不断提升