我要写一个这样的程序,
若游览者浏览aa.asp这个页,
那么在管理员后台的计数器就加一. 可我现在的程序出现了这样的问题:若同时打开aa.asp和管理页,也就是说,我先开管理页,然后游览aa.asp 这个页后,在管理页刷新一下,计数器不会加一;
若我把所有的浏览器关掉,先开aa.asp 然后再打开管理员,就会正常加一,
这是哪里出错呢??
我在 aa.asp 这个页加入以下代码
<%
var filename;
var fs;
if (!Session("count5"))
{
var filename=Server.MapPath("/title/count/yg.txt");
var fs=Server.CreateObject("Scripting.FileSystemObject");
var text=fs.OpenTextFile(filename,1,true);
Session("count5")=text.ReadLine();
Session("count5")++;
text.Close();
var text=fs.CreateTextFile(filename,true);
text.WriteLine(Session("count5"));
text.Close();
}
%>
帮我看一下,哪里有错.
谢谢!!!
<%
dim filename
dim fs
if trim(Session("count5"))<>"" then
filename=Server.MapPath("/title/count/yg.txt")
fs=Server.CreateObject("Scripting.FileSystemObject")
text=fs.OpenTextFile(filename,1,true)
Session("count5")=text.ReadLine()
Session("count5")=Session("count5")+1
text.Close()
text=fs.CreateTextFile(filename,true)
text.WriteLine(Session("count5"))
text.Close()
end if
%>