Weird Session State Problem and Computer Names
One of my colleagues installed one of our ASP.NET
applications on a demo laptop recently and came to
me yesterday since he couldn't get it to work. It didn't
take a long time to figure out that he had forgot the
Infragistics
controls that we use, along with Adobe Acrobat, so I
installed them and tested it using localhost. He came back
a short while later claiming that while it was now running,
it wasn't working correctly, since his entries kept getting
ignored. I tested it again using localhost and it certainly
worked for me -- so I assumed he was doing something wrong
and asked him to try it again. This time he sent me a
screen shot of what he was seeing, and I noticed that he was
using the computer name instead of localhost to access it.
That seems innocent enough, but I decided to try it and sure
enough the session state kept getting lost when using the
computer name, but not with localhost. I looked at all the
settings for IIS and everything else I could think of but it
just didn't make any sense, and I certainly couldn't find
anything wrong. Finally, I looked through the posts in the
ASP.NET Forums
that are related to State Management, looking for anything
about session getting lost. That's when I found this
MS support link
that states cookies, and thus session, will cease to
function if computer names have an underscore! Yes, this
particular computer name had an underscore in it, and of
course localhost doesn't, and it all makes perfect sense
now, although the solution isn't very pretty. Anyhow, I've
never personally used underscores in my computer names, but
I also never realized it was a potential problem, so
beware.