Johnno Nolan
Johnno Nolan

Reputation: 29659

Session.Start called on every request when fired

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?

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

Upvotes: 1

Views: 861

Answers (3)

Johnno Nolan
Johnno Nolan

Reputation: 29659

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

Upvotes: 1

John Saunders
John Saunders

Reputation: 161791

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.

Upvotes: 0

Matthew Steeples
Matthew Steeples

Reputation: 8078

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.

Upvotes: 0

Related Questions