Solved

Global.asa fails on error on any of the page

Posted on 2004-10-13
11
240 Views
Last Modified: 2012-06-21
I am new to the asp world. We have few database calls for updating user logout timings depending on the session exit call. Once there is any kind of error in one of the pages the global.asa file doesnt run correctly. IS this the normal behaviour or is it something else ?

please let me know
thanks
rons
0
Comment
Question by:rohanbairat3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 15

Expert Comment

by:justinbillig
ID: 12301445
Fix the erros on your pages then see if it happens anymore =)
0
 
LVL 5

Expert Comment

by:waelothman
ID: 12302330
any error in global.asa may stope the service for this site

you have to user on error resume
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12305432
what is the error that u get? what do u mean by, file doen't run correctly?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 7

Author Comment

by:rohanbairat3
ID: 12321414
there are no errors on global.asa  .... i am talking about the asp application which is running. We have a data entry application and we tract the user logoff timings. So if a user accidently closes the browser then the global.asa updates the database depending on the session id of the user. Also the user count is maintained in Application variable which doesnt get subtracted.

Please help

thanks
rohan
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12337405
>>Also the user count is maintained in Application variable which doesnt get subtracted
where have u written the code .. under which method of globasl.asa  ...could u please post the code ...
0
 
LVL 7

Author Comment

by:rohanbairat3
ID: 12339911
Sub Session_OnEnd()
           Application.Lock()
        
  set FSO = Server.CreateObject("scripting.FileSystemObject")
    Set file = FSO.OpenTextFile("D:\wwwroot\logfile.txt", 8, True)
 file.WriteLine("----------------------SESSION ON End------------------------")
      file.writeLine("Session.SessionID is "&Session.SessionID)
 if  Session("FCValidUser") = "1" then      
  dim strApplication,strSQL, objConn,NoOfUsers

  'Check if the User is a FC Data Entry User

      file.writeLine("UserName is "&Session("UserName"))
      file.writeLine("Application(NoOfUsersLogged) is "&Application("NoOfUsersLogged"))
      
         If (IsEmpty(Application("FCRecordSet")) ) then
         Else
               strRECSET = Application("FCRecordSet")
               'Clear previous data entry value from session and application object
               'This will let other users use the current value if needed.
                  file.writeLine("RecordID is "&Session("RecordID"))
               if Session("RecordID") <>"" then
                   For i = 0 to UBound(strRECSET)
                         file.writeLine("strRECSET("&i&") "&strRECSET(i))
                         strSessionRecordId = Session("RecordId")
                        ' Need to implement Garbage Collection for this
                         if strRECSET(i) = strSessionRecordId then
                              strRECSET(i) = ""
                         End If
                   Next
               End If 'Session("RecordID")
                  'file.writeLine("Application(FCRecordSet) "&Application("FCRecordSet"))
               Application("FCRecordSet") = strRECSET
         End If

         cRFSFCUserConnection = "DSN=R;UID=someuser;PWD=somepass;"
         Set objConn = Server.CreateObject("ADODB.Connection")
         objConn.ConnectionString = cRFSFCUserConnection
         objConn.Open
         'Note the Logoff Time of the user
         strSQL = "UPDATE DataEntryLog SET LOGOFFTIME = '"&now()&"' WHERE  SESSIONID = '" & Session.SessionID & "'"
         objConn.Execute(strSQL)
         Set objConn = Nothing
      
         NoOfUsers = Application("NoOfUsersLogged")
            file.writeLine("NoOfUsers "&NoOfUsers)
         'Check the Number of Users Logged on. IF the USere are more than 1 then reduce the
         'NoOfUsers by1
         if (NoOfUsers > 1) then
             file.writeLine("Number of users"& Application("NoOfUsersLogged"))
         NoOfUsers = NoOfUsers - 1
             Application("NoOfUsersLogged") = NoOfUsers
              file.writeLine("After subtracting one Number of users "& Application("NoOfUsersLogged"))
         Else
           'IF all the FC users are Logged off Destroy the Application Objects
             file.writeLine("Number of users is less than or equal to 1"&Application("NoOfUsersLogged"))      
           Application.Contents.Remove("NoOfUsersLogged")
             Application.Contents.Remove("FCRecordSet")
             file.writeLine("After removing contents of application(NoOfUsersLogged) and application(FCRecordSet)")      
         End If
      
        

End If
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12344884
so what happens .. isn't log never written or just that the number of users doesn't get substracted .. and just curious .. shouldn't the path of the log file be d:/inetpub/wwwroot ... unless ofcourse u have another directory called wwwroot .. in that case, does the IUR_machinename user have read/write access to this directory?
0
 
LVL 7

Author Comment

by:rohanbairat3
ID: 12347862
the log get written all the time ..but it behaves funky ... sometimes it write sometimes it dows not
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12347976
so when r u checking whether anything has been written to the log file or not .. I beleive session_onend is not fired immediately when a browser is closed .. but it fires based on the session timeout set in IIS for ur site .. check i out .. u could make it to fire immediately with a "session.abandon" command .. but then when will call this if the user closes the browser without loggin out is going to ur next question ..
0
 
LVL 7

Author Comment

by:rohanbairat3
ID: 12425216
I know about the session time out thing... I checked the Event viewer to see if it has some problems ...

can i fire a session.abandon when browser is closed ????
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 125 total points
ID: 12430591
no .. not possible .. u could write code in the windows_onunload or body unload event to trap when the form get unloaded .. but i do not think even this is fired when the browser is closed ...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question