是HttpContext.Current在Web应用程序自从空? [英] Is HttpContext.Current Ever Null in a Web Application?
问题描述
时HttpContext.Current在Web应用程序不断为空(未使用假设线程)?更具体地说,它会永远是空的无效Application_OnError(对象发件人,EventArgs五)
?
Is HttpContext.Current ever null in a web Application (assuming threads are not being used)? More specifically, would it ever be null in void Application_OnError(object sender, EventArgs e)
?
推荐答案
看<一个href=\"http://stackoverflow.com/questions/668447/asp-net-c-applicationerror-in-global-asax-cannot-access-session-variables\">this另一个问题
会议未初始化,直到AcquireRequestState事件添加,所以这点之前发生的任何错误将不会有会话变量。
Session is not initialized until the AcquireRequestState event, so any error occurring before this point will not have session variables available.
我认为同样适用于HttpContext.Current为HttpContext.Current.Session
I think the same applies to HttpContext.Current as HttpContext.Current.Session
所以,是的,我认为HttpContext.Current有时是空的Application_OnError
So yes, I think HttpContext.Current can sometimes be null in Application_OnError
这篇关于是HttpContext.Current在Web应用程序自从空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!