Global.asa .. Session_OnEnd

Results 1 to 2 of 2

Thread: Global.asa .. Session_OnEnd

  1. #1
    Join Date
    Dec 1969

    Default Global.asa .. Session_OnEnd

    I have a user updatable directory database application set up. Users enter an ID & password to log in then can change their information in the database (several pages). <BR><BR>What I would like to accomplish is once a users session has ended that a thank you email be sent to the user. I know how to get the email address out of the dB and how to send an email.<BR><BR>I thought Sessions (specifically Session_OnEnd) might be a good way to solve this. I added Session("emailadr") = email address to send thank you to, once the user sucesfully authenticates.<BR>Then added this to a global.asa in that directory.<BR><BR>&#060;SCRIPT LANGUAGE="VBScript" RUNAT="Server"&#062;<BR>Sub Session_OnStart<BR>&nbsp;&nbsp;&nbsp;Session.Timeo ut = 5<BR>End Sub<BR><BR>Sub Session_OnEnd<BR>&nbsp;&nbsp;&nbsp;Set Mail = Server.CreateObject("Persits.MailSender")<BR>&nbsp ;&nbsp;&nbsp;&#039....Other Mail Code Referencing Session("emailadr")...<BR>End Sub<BR>&#060;/SCRIPT&#062;<BR><BR>I tested the mail code in a std asp page and it works fine, but when a session times out/expires the code in the global.asa does not appear to run.<BR><BR>I posted this a few days back to the "ASP Q&A" board and the only response I recieved was that ... ~"for reasons not explained, Session_OnEnd rarely runs when there is database interaction"~. There is no dB connection in the Session_OnEnd event.. the code simply is checking if Session("emailadr") has been set and if so preforming normal code to generate an email message (which I know works).<BR><BR>Any help/assistance anyone could offer would be appreciated.<BR><BR>Thanks,<BR>Desiree

  2. #2
    Join Date
    Dec 1969

    Default RE: Global.asa .. Session_OnEnd

    I posted the other response and thought you were only asking about db interaction. Session_OnEnd simply doesn&#039t run most of the time; supposedly this was fixed under IIS 5 but have no personal experience. <BR>As an alternative, you could set a value in the db when a user logs in to false. If an email is sent, set it to true. Then, in the session_OnStart (which does work), generate an email for each user where email=false.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts