Microsoft KB Archive/281298

= PRB: Session Variables Do Not Persist When Application Contains Empty Global.asa =

Article ID: 281298

Article Last Modified on 7/14/2004

-

APPLIES TO


 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q281298



SYMPTOMS
If your application contains an empty (0 byte) Global.asa file, session variables may not be maintained as you browse from page to page in your application.



CAUSE
Because Internet Information Server (IIS) tries to parse Global.asa to determine whether there is a Session_OnStart subroutine to process, if Global.asa is empty, IIS fails when it tries to parse the file.



RESOLUTION
To resolve this problem, open Global.asa in Notepad, press the SPACEBAR, and then save the changes. In addition, you can delete Global.asa.



Steps to Reproduce Behavior
 In IIS, create a virtual folder, and make it an application. To make the virtual folder an application, perform the following steps:  In the IIS Management Console, right-click the virtual folder, and then click Properties. On the Virtual Directory tab, in the Application Settings list box, click Create. Click OK. The icon for the virtual folder should change from a folder icon to an application icon (a box that contains a globe).  Add Global.asa, and make sure that it is completely empty.</li>  Add an Active Server Pages (ASP) page named Page1.asp, and then paste the following code: <% session(&quot;test&quot;) = &quot;value&quot; %> <a href=&quot;page2.asp&quot;>Page 2</a> </li>  Add another ASP page named Page2.asp, and then paste the following code: <% Response.Write session(&quot;test&quot;) %> </li> Browse to the first page, and then browse to the second page. The value that is stored in session(&quot;test&quot;) is not persisted.</li></ol>

<div class="references_section">