bueno lo primero tenemos que crear un archivo global.asax y agregar el siguiente codigo
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Try
If IsNumeric(Application.Item("contador")) = False Then
Application.Item("contador") = 1
End If
Dim x1 As Single
x1 = Val(Application.Item("contador").ToString)
x1 = x1 + 1
Application.Item("contador") = x1
Application.Item("urlref") = Me.Request.UrlReferrer.ToString
Catch ex As Exception
End Try
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
Try
If IsNumeric(Application.Item("contador")) = False Then
Application.Item("contador") = 0
End If
Dim x1 As Single
x1 = Val(Application.Item("contador").ToString)
x1 = x1 - 1
Application.Item("contador") = x1
Catch ex As Exception
End Try
End Sub
que hace cuando se inicia una sesion se sumara a la variable contador +1 cuando el servidor genere el timeout hara el -1
bueno para mostrar los usuarios online es facil basta en el master page o la pagina principal
poner un control label o y asignarle el valor
Application.Item("contador"))
Try
label1.text=Application.Item("contador")) .tostring
Catch ex As Exception
label1.text="no anda naiden xD"
End Try
apliquen un try por si las moscas
saludos............
No hay comentarios:
Publicar un comentario