Microsoft KB Archive/303881

= PRB: Session Variables Are Lost in ASP Web Applications =

Article ID: 303881

Article Last Modified on 12/10/2003

-

APPLIES TO


 * Microsoft Active Server Pages 4.0

-



This article was previously published under Q303881



SYMPTOMS
Active Server Pages (ASP) Session variables may not be persisted across requests in the same Web application. This behavior occurs in Web applications that contain the Global.asa file.

You may also receive the following error message:

HTTP 500-12 Application Restarting



CAUSE
This problem can be caused by any anti-virus software that scans the Web application files. It can also be caused by backup software that runs on those files. During each of these processes, if the Global.asa file is marked as modified, it prompts Microsoft Internet Information Services (IIS) to recompile the Global.asa file and then restart the Web application.



RESOLUTION
To resolve this problem, turn off virus scanning or file backup on the Global.asa file. For additional information about the third-party software, contact technical support for the company that produces the software.



STATUS
This behavior is by design.



MORE INFORMATION
When IIS detects changes to the Global.asa file, the server finishes processing all of the current application requests before it recompiles the Global.asa file. During that time, the server refuses additional requests and returns an error message, which states that the request cannot be processed while the Web application is restarting.

After all of the current user requests have been processed, the server deletes all active sessions, calls the Session_OnEnd event for each session that it deletes, closes the application, and then calls the Application_OnEnd event. The Global.asa file is then recompiled.

Subsequent user requests will start the application and create new sessions, which trigger the Application_OnStart and Session_OnStart events. Thus, all previously set ASP Session variables are lost.

