我有一個會話,其中包含我在Main.aspx
上創建的List(of String)
。在我的Global.asax
中,執行以下代碼以在Timer
被觸發後檢索Session
值。嘗試獲取Global.asax中的會話值,但它是NULL
Private Sub Application_AcquireRequestState(sender As Object, e As EventArgs)
If System.Web.HttpContext.Current.Session IsNot Nothing Then
If Session("Products") IsNot Nothing Then
Response.Write(Session("Products").ToString())
End If
End If
End Sub
然而,Session("Products")
返回null,Sub
退出。我想知道End Sub
Main.aspx
是否會釋放Session
,因此每當Timer
啓動時,Session
都是空的。有什麼想法嗎?
您好,也許[這](http://stackoverflow.com/questions/10195791/context-session-object-is-null-in-application-acquirerequeststate)問題可以幫助嗎? – nkvu 2013-04-10 16:37:44