[英]Accessing Session variable from class
I start in a page that inherits from System.Web.UI.Page. 我从一个继承自System.Web.UI.Page的页面开始。 Page.Session is not null at this point. 此时Page.Session不为null。 The page creates a new class. 该页面创建了一个新类。 This class inherits from another class that inherits from System.Web.UI.UserControl. 此类继承自从System.Web.UI.UserControl继承的另一个类。 Once I get into the class, Session is null. 进入课堂后,Session为空。 What do I need for Session state to carry into the class? 会话状态进入课程需要什么?
Both the page and class are in the same webapp. 页面和类都在同一个webapp中。
Have you tried using: 你尝试过使用过:
HttpContext.Current.Session
? ?
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.