Helpful Information
 
 
Category: IIS
Maintaining Session State

I am developing an intranet application for our office network using asp, SQL server and IIS.

Version 1 of the application is has worked absolutely fine up to now.

This morning, I "installed" version 2 onto the server and all works well apart from one really annoying thing...

Session variables are not maintained across pages.

E.g.

The login page creates two session variables, empID and Admin using the following asp code:

session.contents("empID")=cmd.parameters("EmpID").value
session.contents("Admin")=cmd.parameters("Admin").value

...then it redirects to another page as follows:

response.redirect("jobs.asp?stat=browse&type=my")

...jobs.asp cannot then find the session variables.

I have performed a few error-checking tests and found out that between any two pages, the sessionID is not the same. Therefore, i am under the impression that the server is not maintaining session state.

IIS is configured to enable session state with the timeout at a default 20mins.

Anyone got a clue what is going on? I am baffled, as i have used session variables in version 1 with no problems at all and no configuration has changed since then.

Cheers,

Chris

Make sure cookies are enabled in your browser.

Make sure you didn't add an <% @EnableSessionState = false %> somewhere in your code.

There is a pretty extensive discussion of session state here

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/ManagingSessions.asp

Cheers for the link...however, i'm certain that i both have cookies enabled and have not got any code like that.

One article from microsoft I was looking at suggested that a security patch stops session state between requests. Link below:

http://support.microsoft.com/default.aspx?scid=kb;en-us;316112

In short, The suggested resolution was to ensure that the server name was alphanumeric (it is) and to browse using the ip address (i was already)

After a few hours of trying different things, I gave up and went home!

This morning, I am in the process of reinstalling :@ How annoying

One other thought, afaik if your redirect is in a different web application from the redirecting page you'll lose your original session state.

There was no joy after the reinstall.

I set all of the settings in iis to be exactly the same as on my development machine (which did work) and still no change.

Finally, I decided to just start messing about with the settings randomly and guess what, it started working!

I honestly have no clue what I did or why it works now when it didn't before.

I think I may have been playing with the application settings so, like Doug G said, i may have put some of my files in a different application.

Anyway, cheers for your help..no doubt that I will need it again sometime soon!

Chris

I'm glad you got it going. Can't argue with success however it occurs :)










privacy (GDPR)