Hi, Everyone:
I have two problems:
1.Counter:
My counter doesn’t work properly. Some time it can count in, some times not.
Code in global.asa
Sub InCrementCounter()
Set fsc=Server.CreateObject("Scripting.FileSystemObject"
Set txt=fsc.OpenTextFile(Server.MapPath("AcsCounter.txt",1)
Application("Counter"=txt.ReadLine
txt.close
Application("Counter"=Application("Counter"+1
Set txt=fsc.CreateTextFile(Server.MapPath("AcsCounter.txt",1)
txt.Write(Application("Counter")
txt.Close
End Sub
Sub Application_OnStart
On Error Resume Next
''//
Application.Lock
InCrementCounter
Application.Unlock
''//
End Sub
2.Capturing User Session IP Address: I used Request.ServerVariables("Romete_ADDR", but I got nothing. No any IP or URL show up.
Code:
Sub Session_OnStart
On Error Resume Next
strSLog="Insert Into tblWebSession "_
& (EventType,UserURL,Referer,HITIP,RemoteHost,UserAgent,UserSID,HostIP)"_
& "Values('New Session','"_
& Request.ServerVariables("URL" & "','"_
& Request.ServerVariables("HTTP_REFERER" & "','"_
& Request.ServerVariables("Romete_ADDR" & "','"_
& Request.ServerVariables("Romete_Host" & "','"_
& Request.ServerVariables("HTTP_User_Agent" & "',"_
& CLng(Session.SessionID) & ",'"_
& Request.ServerVariables("LOCAL_Addr" & "')"
WriteSessionData(strSLog)
End Sub
Where I did wrong?
By the way, our web server is NT, is that cause the problem?
Thanks advance.
Ann
I have two problems:
1.Counter:
My counter doesn’t work properly. Some time it can count in, some times not.
Code in global.asa
Sub InCrementCounter()
Set fsc=Server.CreateObject("Scripting.FileSystemObject"
Set txt=fsc.OpenTextFile(Server.MapPath("AcsCounter.txt",1)
Application("Counter"=txt.ReadLine
txt.close
Application("Counter"=Application("Counter"+1
Set txt=fsc.CreateTextFile(Server.MapPath("AcsCounter.txt",1)
txt.Write(Application("Counter")
txt.Close
End Sub
Sub Application_OnStart
On Error Resume Next
''//
Application.Lock
InCrementCounter
Application.Unlock
''//
End Sub
2.Capturing User Session IP Address: I used Request.ServerVariables("Romete_ADDR", but I got nothing. No any IP or URL show up.
Code:
Sub Session_OnStart
On Error Resume Next
strSLog="Insert Into tblWebSession "_
& (EventType,UserURL,Referer,HITIP,RemoteHost,UserAgent,UserSID,HostIP)"_
& "Values('New Session','"_
& Request.ServerVariables("URL" & "','"_
& Request.ServerVariables("HTTP_REFERER" & "','"_
& Request.ServerVariables("Romete_ADDR" & "','"_
& Request.ServerVariables("Romete_Host" & "','"_
& Request.ServerVariables("HTTP_User_Agent" & "',"_
& CLng(Session.SessionID) & ",'"_
& Request.ServerVariables("LOCAL_Addr" & "')"
WriteSessionData(strSLog)
End Sub
Where I did wrong?
By the way, our web server is NT, is that cause the problem?
Thanks advance.
Ann