Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 asp.net 应用程序中有一个 Session 对象,我将其设置为 userID 值。会话对象在 gloal.asax 中被实例化。当用户登录并已通过身份验证时,将在 button_click 事件上设置该值。
但是,在我的应用程序的某个地方,会话被设置为空。如何确定会话对象在何处以及如何设置为空?
对项目中的会话变量进行全局搜索。在所有行上放置一个断点。然后仔细检查应用程序。两天前我也遇到了同样的错误。花了四个小时浏览了 80 多页。祝你好运。
发生这种情况的几个原因:
Page_Load()
根据我的经验,上述问题几乎肯定会得到解决。