我在 Global.asax.cs 中以下代码片段中突出显示的代码行上收到 StackOverflowException,有人可以告诉我为什么会发生这种情况吗?
代码:
public static HttpSessionState CurrentSession
{
get
{
if (HttpContext.Current == null)
return null;
return HttpContext.Current.Session;
}
}
谢谢, 亚历克斯。
最佳答案
事实上答案是: “你的堆栈溢出没有发生在这里。也许发布调用它的代码 --- 堆栈溢出中涉及的代码(因为你可能从几个地方调用它)。 – Eben Roux 6 月 30 日 4: 37"
它出现在请求 CurrentSession 的代码中,但这只是它中断的行。
关于c# - HttpContext.Current.Session 给出 StackOverflowException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6529494/