好的,过去,我曾经这样存储会话变量:
Session["NAME"] = Value;
但是,在 4.5 中执行此操作似乎不起作用。当我在 Visual Studio 2012 中使用 QuickWatch 进行调试并检查 Session 的值时 - 我得到以下信息:
NAME = DUP (this is my session name)
VALUE = The Name 'DUP' does not exist in the current context.
所以,我想也许,我不会在课堂上从 Page 实例化 - 但我会。所以我尝试使用
HTTPContext.Current.Session
但 Current 并未在 Visual Studio 中显示为有效选项。