We have an ASP.NET 2.0 website with some old classic ASP pages on it. There is a page login.asp and home.aspx. The Login.asp page is redirected to home.aspx for authenticated and authorized users.
We want to count the number of users visiting the site. If the user reaches a certain value, we show some pop-up window with some information. We save application variables in global.asax file. Please fill in the following code cut for global.asax
Protected Overloads Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("Count") = 0 End Sub Protected Overloads Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("Count") = CInt(Application("Count"))+ 1 End Sub
I refer to the Application (βGraphβ) by the PageLoad method for Home.aspx.
When I open a browser with the URL http://localhost/login.asp
and successfully log in, the counter never increments. If I go to http://localhost/home.aspx
, the score increases. It looks like when login.asp redirects to home.aspx, it does not call session_start in global.asax.
I am not very familiar with Classic asp. End users always come from login.asp.
What is the best way to access the correct added application variable from global.asax file?
source share