Solved

Global.asa fails on error on any of the page

Posted on 2004-10-13
11
238 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery Check against database on select from auto fill not working in all browsers 5 56
key press alert 2 47
Boolean 13 49
Compress Newid value ms sql Mssql 4 46
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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/…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 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