Debugging a Global.asa differs from debugging .asp files.
Application_OnStart
procedure executes the first time that any user accesses any page in an ASP-based application.Application_OnEnd
procedure executes only when the application is shut down.Session_OnStart
procedure executes only once per user session.Session_OnEnd
procedure executes only when a userÆs session times out or when a script explicitly calls the Session
objectÆs Abandon
method.If there is an error in a Global.asa file (either a syntax error or runtime error), the server stops the procedure containing the error. If the Script Debugger is enabled for that ASP application, the server starts the debugger and displays an error message. If the Script Debugger is not enabled for the ASP application, an error message is sent to the client browser. In either case, the procedure containing the error stops. When you fix the error in a Global.asa file and request a page from the application again, the procedures in a Global.asa are executed again when the ASP application is restarted ù a Global.asa file is executed again whenever you make a change in it and save it.
To control when the Script Debugger is called from a Global.asa file, include a statement that starts the debugger explicitly, such as Stop
in VBScript or debugger
in JScript. Place the statement at the beginning of the procedure, before any statements that you will want to step through.
When the application starts or when a user starts a new session, the corresponding procedure in a Global.asa file will run. The Script Debugger will start when the Stop
or debugger
statement is executed. You can then step through the procedure normally, use the Command window to evaluate expressions and set values, and so on.
However, you cannot stop and restart the script by refreshing a Global.asa file. If you want to rerun the Application_OnStart
event procedure, you must stop the application and then restart it. If you want to rerun the Session_OnStart
event procedure, you can restart your browser, which starts a new session and reruns the Session_OnStart
event procedure. Alternatively, you can request a page that includes a script to call the Session
objectÆs Abandon
method, and then start a new session.
© 1997 by Microsoft Corporation. All rights reserved.