Ho provato questo contatore di visite con il codice riportato in basso e salvato con il file counter.asp nel server locale (inetpub/wwwroot/counter /counter.asp )
Lancialdolo direttamente con counter.asp, dà questo errore :
An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error.
Nella cartella counter ci sono il file conta.txt (che contiene la cifra 0 e che dovrà essere incrementato) e le immagini delle cifre: 0.gif, 1.gif, 2.gif, ...
Lanciandolo, invece indirettamente, da un file pagina.htm con la sola riga di programma:
<script language= ‘JavaScript’ src= ‘http://localhost/counter/counter.asp’> </script>
non dà nessun segnale, ma solo una pagina vuota.
Anche provandolo in un server remoto dà risultati analoghi come nel server locale.
Chiedo di conoscere, se possibile, il tipo di errore avvenuto nel server e come, eventualmente, si può correggere. Grazie
lanvoel
codice:<%@ language=JavaScript %> <html> <body> <% Response.Expires = 0 Set fs = CreateObject("Scripting.FileSystemObject") Path = server.mappath("conta.txt") Set a = fs.OpenTextFile(path) conta = CInt(a.ReadLine) If Session("conta") = "" then Session("conta") = conta conta = conta + 1 a.close Set a = fs.CreateTextFile(path, True) a.WriteLine(conta) End If a.Close %>codice:var str = "<%= conta %>"; var begin = "<img src=\"http://localhost/counter/img/"; var middle = ".gif\" alt=\""; var last = "\">"; for(x = 0;x < str.length; x++) { str1 = str.charAt(x); document.write(begin + str1 + middle + str1 + last); } </body> </html>