Danish Habib

Danish Habib

  • NA
  • 694
  • 244k

online users calculation

May 22 2015 3:23 AM
This line in my aspx page gives exception
<%=Application("OnlineVisitors").ToString()%>
 
below are the global.asax code
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
Application("OnlineVisitors") = (CType(Application("OnlineVisitors"), Integer) - 1)
Application.UnLock()
End Sub
 
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
If Session("LoggedInUserId") Is Nothing Then Response.Redirect("Login.aspx", True)
Application.Lock()
' Application("OnlineVisitors") = (CType(Application("OnlineVisitors"), Integer) + 1)
Application("OnlineVisitors") = (CType(Application("OnlineVisitors"), Integer) + 1)
Application.UnLock()
'If Session("LoggedInUserId") IsNot Nothing Then
' GetDays()
'End If
' AutoChecked()
End Sub
 
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RegisterRoutes(RouteTable.Routes)
Application("OnlineVisitors") = 0
' Fires when the application is started
Dim whenTaskLastRan As DateTime
whenTaskLastRan = DateTime.Now
Dim D2 As DateTime = DateTime.Now()
End Sub

Answers (2)