DNR
DNR

Reputation: 3736

asp.net session object being set to empty

I have a Session object in my asp.net app that I am setting to the userID value. The session object gets instantiated in the gloal.asax. The value is being set on a button_click event when a user signs in and has been authenticated.

However, somewhere somehow in my app, the Session is being set to Empty. How can I determine where and how the session object is being set to empty?

Upvotes: 4

Views: 1292

Answers (2)

Csharp
Csharp

Reputation: 2982

Do a global search for the session variable within your project. Put a break point on all of the lines. and then closely step through the application. I just had the same bug two days ago. Took four hours stepping through 80+ pages. Good luck.

Upvotes: 3

m.edmondson
m.edmondson

Reputation: 30862

A couple of reasons this may happen:

  • Are you modifying the variable on Page_Load()?
  • Is your browser returning the session cookie? (You can verify using Fiddler)

In my experience this kind of problem will almost certainly be addressed by the above.

Upvotes: 1

Related Questions