Testa att göra en testsidan med endast koden som finns i count.asp och kommentera bort allt eftersom tills du hittar var felet ligger. Kanske är att IUSR_<computername> inte har rättigheter till counter.txt-filen. Vad vet jag?
Hej,
Har precis färdig ställt en sida åt ett video uthyrningsföretag, men jag får hela tiden ett internt server fel 500... allt fungerar perfekt offline med PWS. varför detta?
har på alla sidor includerad följande rad:
<!--#INCLUDE FILE="data/tracker/count.asp"-->
tar jag bort denna rad fungerar det... alltså är det något fel med min counter men vad?
på sidan som anropar countern har jag följande kod:
<%
Application.Lock
Set TempPages = Application("Pages")
Set TempHost = Application("Host")
Set TempAgent = Application("Agent")
Set TempStart = Application("Starttime")
Application.UnLock
PageItems = TempPages.Items
PageKeys = TempPages.Keys
HostItems = TempHost.Items
AgentItems = TempAgent.Items
StartItems = TempStart.Items
If Instr(Application("Agent").Item(Session.SessionId), "MSIE") then
yourbrowser = "MS Internet Explorer"
else
yourbrowser = "Netscape Navigator / Communicator"
end if
%>
<%=TempPages.Count%> anropar antalet besökare.
count.asp ser ut så här:
<%
'Create instance of the FileSystemObject object
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
'The path of the counter.txt file
CounterFilePath = Server.MapPath("/data/tracker/counter.txt")
'Read from the counter file if it exists
IF MyFileObj.FileExists(CounterFilePath) THEN
Set CounterFile = MyFileObj.OpenTextFile(CounterFilePath)
IF NOT CounterFile.AtEndOfStream THEN
Count = TRIM(CounterFile.ReadAll)
END IF
CounterFile.Close
END IF
'Add 1 if count from Counterfile is ok, else set count = 1
IF IsNumeric(Count) THEN
Count = Count + 1
ELSE
Count = 1
END IF
'Write to the counter file
Set CounterOutStream=MyFileObj.OpenTextFile(CounterFilePath, 2, TRUE)
CounterOutStream.Write(Count)
CounterOutStream.Close
%>
och min global.asa så här:
[kod]
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
On Error Resume Next
Set Application("Pages") = Server.CreateObject("Scripting.Dictionary")
Set Application("Host") = Server.CreateObject("Scripting.Dictionary")
Set Application("Agent") = Server.CreateObject("Scripting.Dictionary")
Set Application("Starttime") = Server.CreateObject("Scripting.Dictionary")
End Sub
Sub Session_OnStart
On Error Resume Next
Application("Starttime").Item(Session.SessionID) = Now
Application("Host").Item(Session.SessionID) = Request.ServerVariables("HTTP_HOST")
Application("Agent").Item(Session.SessionID) = Request.ServerVariables("HTTP_USER_AGENT")
End Sub
Sub Session_OnEnd
On Error Resume Next
If Application("Pages").Exists(Session.SessionID) Then
Application.Lock
Application("Pages").Remove(Session.SessionID)
Application("Host").Remove(Session.SessionID)
Application("Agent").Remove(Session.SessionID)
Application("starttime").Remove(Session.SessionID)
Application.Unlock
End If
End Sub
</SCRIPT>
någon som ser felet?



