Session State Variables not being persisting correctly

Y

yoshibebe

Hi, I have developed a project on my local machine. The session state
variables are working fine on my local machine. When I port it into a
another server called v-projects, and I try to run the project from
that other server, the session state variables are being set randomly.
For example, in the following code:

SetSelectionSessionState();
Response.Redirect(@"http://localhost/WebTemplateExample/MainPage.aspx?NavLink=SelectionStep2&Type=ReportGenerator",
true);

After I set the session state, I redirect to another site. The
variables are lost after this. However, the strange thing that is
happening is that sometimes it will keep the variables, but sometimes
it will not. I have no idea why this is happening on the other server,
when it is working fine on my local machine. Please help!
 
J

John M Deal

Are you by any chance experiencing this issue on a machine that is
running with multiple processors running Windows Server 2003 (or even
just IIS6 on Win2K3)? I ask because what you are describing is what
happens in those types of environments when web gardens are being used
(it can also happen in non-sticky IP web farms).

Session is worker process based unless you change the web.config to
enable StateServer or SqlServer based session state. When you have
multiple worker processes (as in Win2K3/IIS6 web garden configuration)
you have separate worker processes that could potentially handle each
request that the user makes, this in turn causes the Session to behave
erratically.

You don't normally experience this on a development box because people
so rarely develop on similar hardware as they deploy to (though they
really should) and as such they often have only a single worker process
running which in turn means they don't experience this problem.

Be careful if you decide to use StateServer or SqlServer to handle this
issue because it requires any objects that you put in session to be
serializable in order to pass them across the process boundary.

Have A Better One!

John M Deal, MCP
Necessity Software
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top