【发布时间】:2012-12-12 20:00:59
【问题描述】:
我正在尝试按照ASP.NET OutputCache and Cookies 中的建议在 Global.asax.vb 中的 Application_EndRequest 中设置一个 cookie
我写了下面的代码,cookie 得到了ERROR 的值。
为什么会话不可用?
Sub Application_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim context As HttpContext = HttpContext.Current
If Not context.Session Is Nothing Then
context.Response.Cookies("T").Value = context.Session("T")
Else
context.Response.Cookies("T").Value = "ERROR"
End If
End Sub
【问题讨论】:
标签: asp.net session global-asax