General global.asa failure

Discussion in 'ASP General' started by Mikael Hellström, Apr 29, 2004.

  1. Hi, I have some huge problem. I fell sick for several days because of this
    global.asa file problem

    This is my problem:
    I don't have any problem what so ever home on my local computer. Everything
    work like a dream.
    But on the webhotell nothing seems to be ok. It seems like session OnEnd
    nerver execute..?
    I have done the following tests.

    1) SUB Application_OnStart will run because Application("namn") give me the
    value "test" so will the function
    Session_OnStart
    2) I have put this code in session OnEnd
    response.redirect(http://www.someurl.com) but it wont redirect me
    to that url.
    3) I have tryed to replace the code strSQL="delete from online where
    medlemsNr=" & session("medlemsNr")
    to strSQL="delete from online where medlemsNr=100000" dont work!!!

    Soo as i can see it Session OnEnd is never called Why??
    I'm on a Window IIS account and use a Microsoft sql server 2000

    Regards Mikael



    ======================== My global.asa =====================================


    <SCRIPT LANGUAGE=VBScript RUNAT=Server>

    SUB Application_OnStart
    Application("aktivanu") = 0
    Application("namn") = "test"
    END SUB

    SUB Session_OnStart
    Session.Timeout = 10
    application.Lock
    application("aktivanu") = Application("aktivanu") + 1
    application.Unlock
    END SUB

    SUB Session_OnEnd
    application.Lock
    application("aktivanu") = Application("aktivanu") - 1
    application.Unlock

    strCon = connectionStr="Driver={SQL
    Server};Server=mssql.webbhotellsgruppen.se;Uid=XXXX;Pwd=XXXXX;Database=XXXXX
    XDB;"

    Dim objConn ' ADO Recordset Object
    Dim objRS ' ADO Connection Object
    Dim strSQL

    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString=strCon
    objConn.Open

    strSQL="delete from online where medlemsNr=" & session("medlemsNr")
    objConn.Execute strSQL

    End sub

    </script>

    <OBJECT
    RUNAT="Server"
    SCOPE="Application"
    ID="ChatUsers"
    PROGID="Scripting.Dictionary">
    </OBJECT>

    <OBJECT
    RUNAT="Server"
    SCOPE="Application"
    ID="conquerChatRooms"
    PROGID="Scripting.Dictionary">
    </OBJECT>

    <OBJECT
    RUNAT="Server"
    SCOPE="Application"
    ID="ChatMessages"
    PROGID="Scripting.Dictionary">
    </OBJECT>
     
    Mikael Hellström, Apr 29, 2004
    #1
    1. Advertising

  2. Mikael Hellström

    Kris Eiben Guest

    Read:
    http://www.aspfaq.com/show.asp?id=2078

    "Mikael Hellström" <> wrote in message
    news:jZ5kc.91151$...
    > Hi, I have some huge problem. I fell sick for several days because of

    this
    > global.asa file problem
    >
    > This is my problem:
    > I don't have any problem what so ever home on my local computer.

    Everything
    > work like a dream.
    > But on the webhotell nothing seems to be ok. It seems like session

    OnEnd
    > nerver execute..?
    > I have done the following tests.
    >
    > 1) SUB Application_OnStart will run because Application("namn") give

    me the
    > value "test" so will the function
    > Session_OnStart
    > 2) I have put this code in session OnEnd
    > response.redirect(http://www.someurl.com) but it wont redirect me
    > to that url.
    > 3) I have tryed to replace the code strSQL="delete from online where
    > medlemsNr=" & session("medlemsNr")
    > to strSQL="delete from online where medlemsNr=100000" dont work!!!
    >
    > Soo as i can see it Session OnEnd is never called Why??
    > I'm on a Window IIS account and use a Microsoft sql server 2000
    >
    > Regards Mikael
    >
    >
    >
    > ======================== My global.asa

    =====================================
    >
    >
    > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    >
    > SUB Application_OnStart
    > Application("aktivanu") = 0
    > Application("namn") = "test"
    > END SUB
    >
    > SUB Session_OnStart
    > Session.Timeout = 10
    > application.Lock
    > application("aktivanu") = Application("aktivanu") + 1
    > application.Unlock
    > END SUB
    >
    > SUB Session_OnEnd
    > application.Lock
    > application("aktivanu") = Application("aktivanu") - 1
    > application.Unlock
    >
    > strCon = connectionStr="Driver={SQL
    >

    Server};Server=mssql.webbhotellsgruppen.se;Uid=XXXX;Pwd=XXXXX;Database=X
    XXXX
    > XDB;"
    >
    > Dim objConn ' ADO Recordset Object
    > Dim objRS ' ADO Connection Object
    > Dim strSQL
    >
    > Set objConn = Server.CreateObject("ADODB.Connection")
    > objConn.ConnectionString=strCon
    > objConn.Open
    >
    > strSQL="delete from online where medlemsNr=" & session("medlemsNr")
    > objConn.Execute strSQL
    >
    > End sub
    >
    > </script>
    >
    > <OBJECT
    > RUNAT="Server"
    > SCOPE="Application"
    > ID="ChatUsers"
    > PROGID="Scripting.Dictionary">
    > </OBJECT>
    >
    > <OBJECT
    > RUNAT="Server"
    > SCOPE="Application"
    > ID="conquerChatRooms"
    > PROGID="Scripting.Dictionary">
    > </OBJECT>
    >
    > <OBJECT
    > RUNAT="Server"
    > SCOPE="Application"
    > ID="ChatMessages"
    > PROGID="Scripting.Dictionary">
    > </OBJECT>
    >
    >
     
    Kris Eiben, Apr 29, 2004
    #2
    1. Advertising

  3. Hi all,
    Ok i will do like this:
    When the people logg on to my site i set the time in a table and
    use their member id as key.
    Everypage they visit i update this table with a new time.
    Fine...Now i nead some help with a stored procedure. I Have never
    tryed to write some...
    I ned some form of job done can i use a timer so the procedure is called by
    the server in
    some intervall???

    Please can u help me with a code snip or thell me where i can read about
    this!
    Regards Mikael

    "Kris Eiben" <> wrote in message
    news:...
    > Read:
    > http://www.aspfaq.com/show.asp?id=2078
    >
    > "Mikael Hellström" <> wrote in message
    > news:jZ5kc.91151$...
    > > Hi, I have some huge problem. I fell sick for several days because of

    > this
    > > global.asa file problem
    > >
    > > This is my problem:
    > > I don't have any problem what so ever home on my local computer.

    > Everything
    > > work like a dream.
    > > But on the webhotell nothing seems to be ok. It seems like session

    > OnEnd
    > > nerver execute..?
    > > I have done the following tests.
    > >
    > > 1) SUB Application_OnStart will run because Application("namn") give

    > me the
    > > value "test" so will the function
    > > Session_OnStart
    > > 2) I have put this code in session OnEnd
    > > response.redirect(http://www.someurl.com) but it wont redirect me
    > > to that url.
    > > 3) I have tryed to replace the code strSQL="delete from online where
    > > medlemsNr=" & session("medlemsNr")
    > > to strSQL="delete from online where medlemsNr=100000" dont work!!!
    > >
    > > Soo as i can see it Session OnEnd is never called Why??
    > > I'm on a Window IIS account and use a Microsoft sql server 2000
    > >
    > > Regards Mikael
    > >
    > >
    > >
    > > ======================== My global.asa

    > =====================================
    > >
    > >
    > > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    > >
    > > SUB Application_OnStart
    > > Application("aktivanu") = 0
    > > Application("namn") = "test"
    > > END SUB
    > >
    > > SUB Session_OnStart
    > > Session.Timeout = 10
    > > application.Lock
    > > application("aktivanu") = Application("aktivanu") + 1
    > > application.Unlock
    > > END SUB
    > >
    > > SUB Session_OnEnd
    > > application.Lock
    > > application("aktivanu") = Application("aktivanu") - 1
    > > application.Unlock
    > >
    > > strCon = connectionStr="Driver={SQL
    > >

    > Server};Server=mssql.webbhotellsgruppen.se;Uid=XXXX;Pwd=XXXXX;Database=X
    > XXXX
    > > XDB;"
    > >
    > > Dim objConn ' ADO Recordset Object
    > > Dim objRS ' ADO Connection Object
    > > Dim strSQL
    > >
    > > Set objConn = Server.CreateObject("ADODB.Connection")
    > > objConn.ConnectionString=strCon
    > > objConn.Open
    > >
    > > strSQL="delete from online where medlemsNr=" & session("medlemsNr")
    > > objConn.Execute strSQL
    > >
    > > End sub
    > >
    > > </script>
    > >
    > > <OBJECT
    > > RUNAT="Server"
    > > SCOPE="Application"
    > > ID="ChatUsers"
    > > PROGID="Scripting.Dictionary">
    > > </OBJECT>
    > >
    > > <OBJECT
    > > RUNAT="Server"
    > > SCOPE="Application"
    > > ID="conquerChatRooms"
    > > PROGID="Scripting.Dictionary">
    > > </OBJECT>
    > >
    > > <OBJECT
    > > RUNAT="Server"
    > > SCOPE="Application"
    > > ID="ChatMessages"
    > > PROGID="Scripting.Dictionary">
    > > </OBJECT>
    > >
    > >

    >
    >
     
    Mikael Hellström, Apr 29, 2004
    #3
  4. Mikael Hellström

    CJM Guest

    ..sqlserver.programming and/or .asp.db would be good places to ask this
    question.

    Note: You dont want to delete peoples session data xx minutes after they
    have joined your site. You want to remove them xx minutes after their last
    action - therefore every page will need to update the db with the time that
    the user calls the page:

    'Update Sessions Set LastAccessed = GetDate()'

    Then your clearup code would then check for sessions that hadnt been used in
    xx minutes.

    hth

    CJM

    "Mikael Hellström" <> wrote in message
    news:fjbkc.91178$...
    > Hi all,
    > Ok i will do like this:
    > When the people logg on to my site i set the time in a table and
    > use their member id as key.
    > Everypage they visit i update this table with a new time.
    > Fine...Now i nead some help with a stored procedure. I Have never
    > tryed to write some...
    > I ned some form of job done can i use a timer so the procedure is called

    by
    > the server in
    > some intervall???
    >
    > Please can u help me with a code snip or thell me where i can read about
    > this!
    > Regards Mikael
    >
    > "Kris Eiben" <> wrote in message
    > news:...
    > > Read:
    > > http://www.aspfaq.com/show.asp?id=2078
    > >
    > > "Mikael Hellström" <> wrote in message
    > > news:jZ5kc.91151$...
    > > > Hi, I have some huge problem. I fell sick for several days because of

    > > this
    > > > global.asa file problem
    > > >
    > > > This is my problem:
    > > > I don't have any problem what so ever home on my local computer.

    > > Everything
    > > > work like a dream.
    > > > But on the webhotell nothing seems to be ok. It seems like session

    > > OnEnd
    > > > nerver execute..?
    > > > I have done the following tests.
    > > >
    > > > 1) SUB Application_OnStart will run because Application("namn") give

    > > me the
    > > > value "test" so will the function
    > > > Session_OnStart
    > > > 2) I have put this code in session OnEnd
    > > > response.redirect(http://www.someurl.com) but it wont redirect me
    > > > to that url.
    > > > 3) I have tryed to replace the code strSQL="delete from online where
    > > > medlemsNr=" & session("medlemsNr")
    > > > to strSQL="delete from online where medlemsNr=100000" dont work!!!
    > > >
    > > > Soo as i can see it Session OnEnd is never called Why??
    > > > I'm on a Window IIS account and use a Microsoft sql server 2000
    > > >
    > > > Regards Mikael
    > > >
    > > >
    > > >
    > > > ======================== My global.asa

    > > =====================================
    > > >
    > > >
    > > > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    > > >
    > > > SUB Application_OnStart
    > > > Application("aktivanu") = 0
    > > > Application("namn") = "test"
    > > > END SUB
    > > >
    > > > SUB Session_OnStart
    > > > Session.Timeout = 10
    > > > application.Lock
    > > > application("aktivanu") = Application("aktivanu") + 1
    > > > application.Unlock
    > > > END SUB
    > > >
    > > > SUB Session_OnEnd
    > > > application.Lock
    > > > application("aktivanu") = Application("aktivanu") - 1
    > > > application.Unlock
    > > >
    > > > strCon = connectionStr="Driver={SQL
    > > >

    > > Server};Server=mssql.webbhotellsgruppen.se;Uid=XXXX;Pwd=XXXXX;Database=X
    > > XXXX
    > > > XDB;"
    > > >
    > > > Dim objConn ' ADO Recordset Object
    > > > Dim objRS ' ADO Connection Object
    > > > Dim strSQL
    > > >
    > > > Set objConn = Server.CreateObject("ADODB.Connection")
    > > > objConn.ConnectionString=strCon
    > > > objConn.Open
    > > >
    > > > strSQL="delete from online where medlemsNr=" & session("medlemsNr")
    > > > objConn.Execute strSQL
    > > >
    > > > End sub
    > > >
    > > > </script>
    > > >
    > > > <OBJECT
    > > > RUNAT="Server"
    > > > SCOPE="Application"
    > > > ID="ChatUsers"
    > > > PROGID="Scripting.Dictionary">
    > > > </OBJECT>
    > > >
    > > > <OBJECT
    > > > RUNAT="Server"
    > > > SCOPE="Application"
    > > > ID="conquerChatRooms"
    > > > PROGID="Scripting.Dictionary">
    > > > </OBJECT>
    > > >
    > > > <OBJECT
    > > > RUNAT="Server"
    > > > SCOPE="Application"
    > > > ID="ChatMessages"
    > > > PROGID="Scripting.Dictionary">
    > > > </OBJECT>
    > > >
    > > >

    > >
    > >

    >
    >
     
    CJM, Apr 30, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darlene Gauthier

    PostRequestHandlerExecute event in global.asa

    Darlene Gauthier, Jul 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,444
    Karl Seguin
    Jul 23, 2003
  2. Kevin Spencer

    Re: global.asa file (count sessions)

    Kevin Spencer, Jul 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    364
    Kevin Spencer
    Jul 30, 2003
  3. DevBoy

    Global.asa File ?????

    DevBoy, Aug 12, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    371
    Rick Strahl [MVP]
    Aug 13, 2003
  4. Wayne
    Replies:
    2
    Views:
    493
    Wayne
    Nov 11, 2003
  5. Raghu
    Replies:
    1
    Views:
    4,122
    Raghu
    Feb 17, 2005
Loading...

Share This Page