PRB: Session Variables Are Lost in ASP Web Applications

Article translations Article translations
Article ID: 303881 - View products that this article applies to.
This article was previously published under Q303881
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all


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


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.


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.


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.


For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
248013 Err Msg: HTTP Error 500-12 Application Restarting
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.


Article ID: 303881 - Last Review: November 2, 2013 - Revision: 2.0
Applies to
  • Microsoft Active Server Pages 4.0
kbnosurvey kbarchive kbaspobj kbprb kbwebserver KB303881

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from