Solved

Global.asa fails on error on any of the page

Posted on 2004-10-13
11
234 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
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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 information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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