?
Solved

Evaluate Global.asa file

Posted on 2002-06-20
12
Medium Priority
?
285 Views
Last Modified: 2012-06-21
One of my hosting companies sent me a copy of a global.asa file that is causing one of there servers to not serve .asp files, (html files still process), anyone care to comment on it?

-------------------- start --------------------------
<script language=VBScript runat=Server>

Sub Application_Onstart

Dim TempArray(15)
Application("visits") = 0
Application("active") = 0
Application("lastaccessed") = Now
Application("lastloggedon") = Now
application("lastloggedonuser") = "" 

application("Chatters") = ","
Application("Talk")=TempArray
Application("TPlace")=15

End Sub

Sub Application_OnEnd

End Sub

Sub session_onstart

session.timeout = 120
application.lock
            Application("lastaccessed") = Now
application.unlock
application.lock
            Application("visits") = Application("visits") + 1
application.unlock
application.lock
            Application("active") = Application("active") + 1
application.unlock

End sub

Sub Session_OnEnd
application.lock
        TempArray=Application("Talk")
        TempArray(1) = Temparray(2)
        TempArray(2) = Temparray(3)
        TempArray(3) = Temparray(4)
        TempArray(4) = Temparray(5)
        TempArray(5) = Temparray(6)
        TempArray(7) = Temparray(8)
        TempArray(8) = Temparray(9)
        TempArray(9) = Temparray(10)
        TempArray(10) = Temparray(11)
        TempArray(11) = Temparray(12)
        TempArray(12) = Temparray(13)
        TempArray(13) = TempArray(14)
        TempArray(14) = Temparray(15)
        TempArray(15)= "Citizen " & session("name") & " has logged out."
            strfilename = "D:\html\users\xyz\html\database\chatlog.txt"
            set objfilefso = CreateObject("Scripting.FileSystemObject")
        set objfilets = objfilefso.openTextFile(strfilename,8)
            Application("chatters") = replace(application("chatters"),"," & session("name") &",", ",")

            Application("Talk")=TempArray
            Application("active") = Application("active") - 1
application.unlock
end Sub

</script>

----------------------- end --------------------------

I don't particularly care for the use of the global.asa, and I really don't like calling FSO with Session_OnEnd.

The only real bit of information I can decypher from the faulting site is that the asa application objects are being referenced from a .pl script.  I did find an article on MS, http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q300883 that touched on the CGI issue, but the error log states that the .asa file is causing the problem, not the CGI.

Thanks,
0
Comment
Question by:mgfranz
[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
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 200 total points
ID: 7097562
I am somewhat puzzled about the code in Session_OnEnd. It opens a file for appending, then it doesn't write anything to it... it doesn't even close the file.

Check the permission for the file. If they are not sufficient, the script will end while the application is still locked. The documentation says that if left locked, the application will be unlocked when the asp page ends or times out. I'm not certain in what extent that applies to global.asa...

So, there are some things you can do to increase the stability:

- Dimension the variables used in Session_OnEnd. That makes them local to the sub. I don't feel comfortable having global variables in global.asa... especially not if one of them is a (still open) file...!

- Open the file outside the application lock. If the file operation fails, at least there is no risk of leaving the application in a locked state.

- Close the file!

- Even better would of course be to add proper error handling when opening the file. Then you can also handle the (maybe unlikely, but still...) event that the file is already opened by another session running Session_OnEnd.
0
 
LVL 4

Expert Comment

by:jkunal
ID: 7097786
seconds greenghost

error handling missing.
file not closed.
object not released.
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 7097890
>file not closed.
object not released.

indeed.. this can lock the application for ever so asp files will not be processed..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 18

Author Comment

by:mgfranz
ID: 7099287
Thanks to everyone, I missed the open object not being closed...

Since this .asa file belongs to some other web-site, the hosting company will have to recommend the changes to the client, until then the .asa has been suspended.

One more reason to not rely on the .asa for Session_OnEnd calls...
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7099341
Is this hosted on ntwebhost by anychance?
0
 
LVL 18

Author Comment

by:mgfranz
ID: 7099343
Nope, a Verio sub called NexPoint.net
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7100299
what error message was displayed in the log file for the .asa?

0
 
LVL 18

Author Comment

by:mgfranz
ID: 7102199
I'll find out.
0
 
LVL 4

Expert Comment

by:jkunal
ID: 7102655
you never know how many connections have they left open in the asp files.

Once had the same problem, ppl developed a site and followed no pactice, had to restart the sever every 2nd day. No connection or recordset was ever closed.
0
 
LVL 18

Author Comment

by:mgfranz
ID: 7104489
Actually since I implemented a fix on the .asa file, the host has not had to restart the server since Thursday, they use to have to restart it every morning...

The error message was non-descript really, it just said, "IIS cannot write to the log file, ..." and "The global.asa file cannot open temp file..."
0
 
LVL 11

Expert Comment

by:mouatts
ID: 7104945
Thanks mgfranz I'll pass that on to my ISP.
0
 
LVL 18

Author Comment

by:mgfranz
ID: 7114854
Thanks for your help...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 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