PRB: Session Variables Are Lost When ASP Is Located in Frameset

Article translations Article translations
Article ID: 178037 - View products that this article applies to.
This article was previously published under Q178037
Expand all | Collapse all

SYMPTOMS

Session variables that are defined in an Active Server Pages (ASP) page are empty when you attempt to access the values from other ASP pages within the frameset.

CAUSE

Internet Explorer 4.x and 5 cannot host the different frames of a frameset in the same process. Because ASP sessions are dependent on a Cookie that resides in the memory of the hosted process, different processes result in different Session Cookies and, therefore, different Sessions.

RESOLUTION

If your application must support Internet Explorer 4.x or Internet Explorer 5, then you should replace Session variables with Cookies. Ensure that the Cookies have an expiration date. This will result in the Cookie being written to disk. Regardless of which process the frame is hosted in, all frames will gather the Cookie information from the same location on disk.

For example, replace the following code
  Session("MyVariable") = "MyValue"
				
with:
  Response.Cookies("MyVariable") = "MyValue"
  Response.Cookies("MyVariable").Expires = Now() + 1 '24 hours
				
Note that Cookies must be written before any output is streamed to the browser. You may also need to enable output buffering on your page with the following code:
<%@ Language=VBScript %>
<%
Response.Buffer = True
%>
				
IIS 5.0 ASP pages have output buffering enabled by default. IIS 4.0 ASP pages do not.

NOTE: This behavior has been resolved with Internet Explorer 5.5.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
196383 FIX: Windows Opened by Script Lose Authentication or Session

Properties

Article ID: 178037 - Last Review: June 24, 2004 - Revision: 4.1
APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 5.0
Keywords: 
kbaspobj kbcodesnippet kbprb kbscript KB178037

Give Feedback

 

Contact us for more help

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