이 그 아래 코드는 내 DLL 파일입니다 : 내가 설정 한Session_End 이벤트 중에 HttpContext.Current가 null 인 이유는 무엇입니까?
public static class UserCount
{
public static void add()
{
HttpContext.Current.Application.Lock();
int count = (int) HttpContext.Current.Application["CountOfUsers"];
count++;
HttpContext.Current.Application["CountOfUsers"]=count;
HttpContext.Current.Application.UnLock();
}
public static void subtract()
{
HttpContext.Current.Application.Lock();//error : HttpContext.Current is null. why?
int count = (int) HttpContext.Current.Application["CountOfUsers"];
count--;
HttpContext.Current.Application["CountOfUsers"]=count;
HttpContext.Current.Application.UnLock();
}
}
Session.TimeOut=1;
1 분 아래 Global.asax 파일의 방법 후,이 실행됩니다 :
protected void Session_End(object sender, EventArgs e)
{
UserCount.subtract();
}
왜 subtract
방법 HttpContext.Current
null가 예외를 던질 원인이?
철자 검사를 포함하여 더 명확하게 질문을 시도하십시오. –
'global.asax','session_end' – Abhitalks
@AndersAbel 님이 고칠 수 있었습니까? – rene