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

Mi contador se reinicia

Estas en el tema de Mi contador se reinicia en el foro de ASP Clásico en Foros del Web. Buenas tardes, un saludo a toda la comunidad. Actualmente tego una web que me refleja en pantalla la cantidad de usuarios que la visitan, pero ...
  #1 (permalink)  
Antiguo 06/12/2009, 17:43
 
Fecha de Ingreso: enero-2009
Mensajes: 112
Antigüedad: 16 años, 3 meses
Puntos: 0
Mi contador se reinicia

Buenas tardes, un saludo a toda la comunidad.
Actualmente tego una web que me refleja en pantalla la cantidad de usuarios que la visitan, pero cuando se reinicia el servidor estos datos se ponen en cero, lo que quiero saber es si hay alguna forma de que esto no ocurra, como puedoo hacer para que mantenga los datos aun cuando se reinici el serv. estoy trabajando con asp.
Muchas gracias a quienes me puedan ayudar.
  #2 (permalink)  
Antiguo 06/12/2009, 21:23
Avatar de AlZuwaga
Colaborador
 
Fecha de Ingreso: febrero-2001
Ubicación: 34.517 S, 58.500 O
Mensajes: 14.550
Antigüedad: 24 años, 2 meses
Puntos: 535
Respuesta: Mi contador se reinicia

Seguramente estás usando variables aplicattion. Sería lo mismo que hacés actualmente pero, en vez de almacenar los datos allí, volátilmente, lo harías en una base de datos o un archivo de texto.
__________________
...___...
  #3 (permalink)  
Antiguo 07/12/2009, 05:20
Avatar de Valery-Net  
Fecha de Ingreso: agosto-2008
Mensajes: 694
Antigüedad: 16 años, 7 meses
Puntos: 12
Respuesta: Mi contador se reinicia

Correcto lo que te menciona el compañero AlZuwaga, al almacenar las el valor de las visitas en variables de aplicación esta se reiniciarán cuando el servidor también sea reiniciado o cuando se reinicie el pool de aplicaciones asignado a tu web
  #4 (permalink)  
Antiguo 07/12/2009, 08:44
 
Fecha de Ingreso: enero-2009
Mensajes: 112
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Mi contador se reinicia

gracias compañeros me voy a poner en ello, cualquier cosa les escribo nuevamente, gracias de nuevo.
  #5 (permalink)  
Antiguo 08/12/2009, 21:01
 
Fecha de Ingreso: enero-2009
Mensajes: 112
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Mi contador se reinicia

compañeros les indico el codigo que estoy empleando, porfa verifiquenlo a ver porque no me funciona. Gracias y disculpen la molestia...
esta es la pagina de contador----

<html>

<head>
<title>visitas</title>
</head>

<body>
<%

' Every time we count a user we will put the
' latest count value in the session variable "TotalCount"
' If Session Variable TotalCount is empty
' that mean this user is new and session variable
' But if Session Variable already has the value
' Then we will not count this user again.

If IsEmpty(Session("TotalCount")) Then
Call CountThisUser
End If

' It is good practice to use Functions and Sub procedure
' Because all the variables being used in sub or function
' are automatically destroyed when Sub or Function finish
' processing the code.
' So you can use these Variables again in other functions
Sub CountThisUser()

Dim objFSO ' FileSystemObject
Dim objTS ' TextStreamObject

Dim strFileName ' Counter text File Name
Dim intOldCount
Dim intNewCount

' Specify the Text file to store count value
' Because We Set Create = True
' File will be Created if it does not exist

strFileName = Server.MapPath("Contador.txt")

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(strFileName) Then
Set objTS = objFSO.OpenTextFile(strFileName, 1)
Else
Set objTS = objFSO.CreateTextFile(strFileName, True)
End If

If Not objTS.AtEndOfStream Then
intoldCount = objTS.ReadAll
Else
intoldCount = 0
End If

objTS.Close

intNewCount = intOldCount + 1

' Store the value of intNewCount in Session Variable
' So you can use it on different pages
Session("TotalCount")= intNewCount

' Write intNewCount value back to text file

Set objTS = objFSO.CreateTextFile(strFileName, True)
objTS.Write intNewCount

objTS.Close

Set objFSO = Nothing
Set objTS = Nothing
End Sub
%>

<!--
Count.asp file is added to this page with Server Side Include and
Session Variable is used to display the current user count.
Include File="Count.asp"

AQUI IMPRIMO EL TOTAL DE VISTAS-->
<%=Session("TotalCount")%>


</BODY></HTML>

***************y este es el codigo que se carga en mi home**************


<div align="CENTER"><span class="style13">TOTAL VISITAS:</span><font face="Geneva, Arial, Helvetica, sans-serif" color="#FFFFFF" size="2"><!--#include file="cont_visit.asp"--></font></div>


<!--<div align="right"><span class="style10">Eres el visitante nº:</span> <span class="style4"><%=application("visitas")%></span> <span class="style10">desde el dia</span> <span class="style4"><%=application("fecha")%></span></div>-->


********************GRACIAS ESPERO ME PUEDAN AYUDAR**********
  #6 (permalink)  
Antiguo 14/12/2009, 17:49
 
Fecha de Ingreso: enero-2009
Mensajes: 112
Antigüedad: 16 años, 3 meses
Puntos: 0
Respuesta: Mi contador se reinicia

gracias colegas ya esta listo lo hice con una base de datos y me funciona al pelo
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 00:24.