views:

197

answers:

3

I've got a "works on my machine" situation.

I have a website where I'm passing session values from one page to another using

Session["foo"] = 'blah';

and on page2

var foo = Session["foo"];

foo doesn't exist on page2.

When tracing the page I've found it was using a different sessionid to the original page. When putting a breakpoint on Session_start it looks like for each request the page is starting a new session.

This does not occur on my machine... and thoughts on what I can do to solve on other machines?

  • The SessionState is InProc

  • Page1.aspx and Page2.aspx are both part of the same website and

  • Privacy is set to accept all cookies on the target machine.

EDIT: Difference between running on my machine and target is that I am using http://localhost/blah locally and http://XX_0001/blah from the other client where XX_0001 is my machine

A: 

My first guess would be to check to see if cookies are enabled on the computer that is having the problem. Does it work in other browsers etc?

If you're changing the url as well, ensure that you're still on the same site because different sites will use different cookies.

Matthew Steeples
its still the same site.
John Nolan
A: 

I thought the string indexing Session was case sensitive. You've got "foo" and "Foo". Is that a typo?

Otherwise, cookies would be my guess as well.

John Saunders
+1  A: 

Well I think I have found the solution:

It looks like the _ in my machine name is causing the issue. Seems that hostnames do not allow underscores: http://www.faqs.org/rfcs/rfc822.html

John Nolan