Search code examples
sessionasp-classiconstartglobal.asa

session_onstart does not fire classic asp


My Session_OnStart in my golbal.asa file won't fire on one machine but works as expected on the other. Both machines are Windows server 2003 with IIS6. Here is my code.

global.asa

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
    Sub Application_OnStart
        Application.Lock()
        Application("INSESSION") = "NO"
        Application.Unlock()
    End Sub

    Sub Application_OnEnd
    End Sub

    Sub Session_OnStart
        Application("INSESSION") = "YES"
    End Sub

    Sub Session_OnEnd
    End Sub
</SCRIPT>

test.asp
<%
    response.Write Application("INSESSION")
%>

Value of the application variable is always "NO". Do you guys have any suggestions?


Solution

  • Session state was disabled in IIS on the machine which is causing the issue. After I enabled Session state, Session_OnStart in my golbal.asa file started working.