I set up several pages to work with sessions on both IIS5 (W2K) and IIS6 (W2K3). It appears that both work the same. Sessions variables
remain intact until the session times out or all the IE browsers on the client machine are shutdown. I think Opera browser create a new
session for each instance of a connection to IIS (I'll have to check this)
Other things that can cause session variables to reset is touching the Global.asa file which makes IIS think it needs to recycle all the
sessions. I've included the test files below, and would like to hear from anyone with different results.
global.asa << include the Session_OnStart into your Global.asa, this set's an initial session variable
Session1.asp << This sets some session variables and redirects to Session2
Session2.asp << this Writes the session variables and a form. The button actions Session3.asp
Session3.asp << This writes the session variables and on button push, goes to Session1.asp which redirects to Session2
The session variable called LoopTick (Initially set by global.asa) contains a hostory fo the session pages being accessed.
Global.asa
===========
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart()
Session( "LoopTick" ) = "SessionStarted" & now & " >"
End Sub
</SCRIPT>
Session1.asp
===============
<HTML>
<body>
<%
Response.write( "<br>In Session1.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "1"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )
Session( "able" ) = "Sess1-1"
Session( "baker" ) = "Sess1-2"
Response.redirect( "Session2.asp" )
%>
</body>
</HTML>
Session2.asp
============
<HTML>
<body>
<%
Response.write( "<br>In Session2.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "2"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )
Response.write( "<br>Able=" & Session( "able" ) )
Response.write( "<br>Baker=" & Session( "baker" ) )
Response.write( "<br>Resetting Session variables" )
Session( "able" ) = "Sess2-1"
Session( "baker" ) = "Sess2-2"
Response.flush()
%>
<Form method="POST" name="MyForm" ACTION="Session3.asp" >
<INPUT TYPE=Submit VALUE="Goto Session3 page ">
</FORM>
</body>
</HTML>
Session3.asp
=============
<HTML>
<body>
<%
Response.write( "<br>In Session3.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "3"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )
Response.write( "<br>Able=" & Session( "able" ) )
Response.write( "<br>Baker=" & Session( "baker" ) )
Response.write( "<br>Resetting Session variables" )
Session( "able" ) = "Sess3-1"
Session( "baker" ) = "Sess3-2"
Response.flush()
%>
<Form method="POST" name="MyForm" ACTION="Session1.asp" >
<INPUT TYPE=Submit VALUE="Goto Session1 page ">
</FORM>
</body>
</HTML>
-rwg
This is what I think, not necessarily what is accurate!
--------------------
| Thread-Topic: Response.Redirect problem
| thread-index: AcQC/3V1r2KDKS2tQJCASKwLMzYQZg==
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
| From: "=?Utf-8?B?TGFuc2U=?=" <
[email protected]>
| References: <
[email protected]>
| Subject: RE: Response.Redirect problem
| Date: Fri, 5 Mar 2004 14:16:08 -0800
| Lines: 4
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.inetserver.asp.general
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:267636
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
|
| You are losing your session variables
There are a bunch of us that are having the same problem
You will find that the session variables are gone and you run the
session_onstart at every page.
|