0

I have two sites running on the same server (IIS7 on Win2003).

Site A is my production site.

Site B is a development version of site A. Aside from connection strings in its web.config file, both sites are running the same code.

There are some session variables created in Session_OnStart in global.asax. I've noticed over the past couple weeks, Site A's session variables aren't being properly created. (These variables are used to populate a couple of dropdownlists) This causes the drop-downs not to auto-populate or other errors depending on the page the user is trying to hit.

Site B's session variables have been working correctly. When I hit Site B, the drop-downs populate as I expect.

The first thing I want to try is an IIS reset to see if this corrects the problem, but I'm wondering why my sessions wouldn't be created correctly if both sites are running the same code?

Tim
  • 4,051
  • 10
  • 36
  • 60
  • Do both sites have the same session store? If using sql as session store, can you verify that connections are properly created? – EdSF Oct 01 '12 at 14:13
  • They're both using the default session management (InProc). – Tim Oct 01 '12 at 14:28
  • See [this SO answer](http://stackoverflow.com/a/3516058/304683) for possibilities. – EdSF Oct 01 '12 at 14:35

1 Answers1

0

I figured out a solution but I'm still at a loss as to why this is happening.

I wound up coding defensively to handle the session variable I'm interested in not being properly initialized. When this happens I've got code that properly sets the variable. (In all the years I've been a .NET developer, this is the first time session has been an issue)

I can rule out most of the common causes - I know the session wasn't timing out, and I know no updates were made to web.config or any IIS settings (it's a production site, so nobody touches IIS without putting in a support ticket, and the only person who puts in support tickets for IIS is me).

This seemed to be a problem when users clicked on a particular link in the site. For some reason visiting this particular page caused the session variable to be lost. I'm at a loss to explain the why but at least I've got the code working and not throwing an exception anymore.

Tim
  • 4,051
  • 10
  • 36
  • 60