Foros del Web » Programando para Internet » ASP Clásico »

¿Cómo puedo hacer un log para registrar todo lo que hace un usuario dentro de mi web?

Estas en el tema de ¿Cómo puedo hacer un log para registrar todo lo que hace un usuario dentro de mi web? en el foro de ASP Clásico en Foros del Web. Creo que el titulo lo dice todo verdad???? Espero que alguien me pueda ayudar.... Saludos...
  #1 (permalink)  
Antiguo 24/07/2003, 12:44
 
Fecha de Ingreso: julio-2003
Ubicación: Padrísimo
Mensajes: 20
Antigüedad: 20 años, 11 meses
Puntos: 0
¿Cómo puedo hacer un log para registrar todo lo que hace un usuario dentro de mi web?

Creo que el titulo lo dice todo verdad????

Espero que alguien me pueda ayudar....

Saludos
  #2 (permalink)  
Antiguo 25/07/2003, 02:21
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 21 años, 1 mes
Puntos: 0
A mi no me funciona:
este es el codigo que he encontrado en devasp.com

Creating a Log File
Are you interested to know who came to your site? at what time? and what was the referring URL. Here is an example how to make a Log file for an ASP page to keep track of users on your site. With this Log file you will be able to check who visited your site, At what time, What was the reffering URL and what browser that user was using.

This Example use a text file to write user information. If you want to learn more about how to write to a text file within an ASP page Click here.
Create a file LogFile.asp with the following code and add in the header of every page useing Server Side #Include.

<!--#Include File="LogFile.asp"-->

When some one will come to your site on any page which has LogFile.asp included that user's information will be written to LogFile.txt. If the refering url is from same site, LogFile.asp will not write that information.

File: LogFile.asp <%Dim blnValidEntry ' Log variable
' First set that this log is valid blnValidEntry = True
' If Session Variable "LogIn" is not empty ' that mean this person has already been logged' then set blnValidEntry to False
If not IsEmpty(Session("LogIn")) then blnValidEntry = False
' Here you can add different restriction' If the refering url is from same site ' then there is no need to write to log file
If Left(Request.ServerVariables("HTTP_REFERER"), 17)="http://devasp.com" Then blnValidEntry = FalseEnd If
If Left(Request.ServerVariables("HTTP_REFERER"), 21)="http://www.devasp.com" Then blnValidEntry = FalseEnd If
' Now if blnValidEntry is True then enter to log file
If blnValidEntry Then Const ForAppending = 8 Const Create = true Dim FSO Dim TS Dim MyFileName Dim strLog MyFileName = Server.MapPath("MyLogFile.txt")
Set FSO = Server.CreateObject("Scripting.FileSystemObject") Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create) ' Store all the required information in a string Called strLog
strLog = "<br><P><B>" & NOW() & "</B> " strLog = strLog & Request.ServerVariables("REMOTE_ADDR") & " " strLog = strLog & Request.ServerVariables("HTTP_REFERER") & " " strLog = strLog & Request.ServerVariables("HTTP_USER_AGENT") & "<BR>"
' Write current information to Log Text File. TS.write strLog TS.Writeline ""
' Now Create a session varialbe to check next time for ValidEntry
Session("LogIn") = "yes" Set TS = Nothing Set FSO = NothingEnd If%>


SI CONSIGUES QUE TE FUNCIONE DIME COMO LO HAS HECHO, ESPERO HABERTE AYUDADO
  #3 (permalink)  
Antiguo 25/07/2003, 09:58
Avatar de maestro  
Fecha de Ingreso: febrero-2002
Ubicación: España
Mensajes: 2.364
Antigüedad: 22 años, 4 meses
Puntos: 1
Una forma es como plantean en el mensaje anterior, haciendo #includes en todas las paginas, pero ademas de ser muy pesado te obliga a reprogramar TODAS las paginas de tu sitio.

La mejor opcion es acceder a los ficheros LOG del IIS o APACHE, que ademas estan en formatos standard aceptados por todos los programas que generan estadisticas e informes.

Si quieres hacerlo en tu propio equipo no tienes problema, si se trata de una web de pago pide a tu administrador acceso a los log, si te lo da ya esta todo solucionado.
__________________
Jose Maria Fernandez
[email protected]
Http://www.expansionweb.net
  #4 (permalink)  
Antiguo 25/07/2003, 12:15
 
Fecha de Ingreso: julio-2003
Ubicación: Padrísimo
Mensajes: 20
Antigüedad: 20 años, 11 meses
Puntos: 0
De acuerdo Gracias por las sugerencias

Muchas gracias por la sugerencias dadas y creo que lo mejor sería acceder a los archivos log que mencionan MAESTRO. De todos modos intentare con el código que me envio SQA212 y ya te informare si funciona o no el código.

MIL GRACIAS Y SALUDOS
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:40.