【发布时间】:2017-06-10 18:21:40
【问题描述】:
我有一个 ASP.Net MVC - 5 应用程序,并且在其中一个地方我将值存储在 Session 中
System.Web.HttpContext.Current.Session["MyValue"] = user.SessionID;
我能够以
的身份访问该值int x = (int)System.Web.HttpContext.Current.Session["MyValue"];
但我想在停止 IIS Express 时访问相同的值。我知道Application_End 是从Global.asax 调用的。
protected void Application_End()
{
int x = (int)System.Web.HttpContext.Current.Session["MyValue"];
}
但是 x 的值是空的。是否有任何特殊原因导致 Application_End() 中的会话值不可用。我在这里错过了什么吗?
【问题讨论】:
标签: c# asp.net asp.net-mvc iis asp.net-mvc-5