By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,990 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,990 IT Pros & Developers. It's quick & easy.

Session State Variables not being persisting correctly

P: n/a
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=ReportGe nerator",
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!
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

yoshibebe wrote:
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=ReportGe nerator",
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!

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.