简体   繁体   中英

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM