简体   繁体   中英

Accessing Session variable from class

I start in a page that inherits from System.Web.UI.Page. Page.Session is not null at this point. The page creates a new class. This class inherits from another class that inherits from System.Web.UI.UserControl. Once I get into the class, Session is null. What do I need for Session state to carry into the class?

Both the page and class are in the same webapp.

Have you tried using:

HttpContext.Current.Session

?

Good luck!

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