在什么情况下 HttpContext.Current.Session 可以为空?
我有一些asp.net 页面。
我只是想知道为什么我应该总是检查 Session 对象是否为 null ?
例如
public static object GetSession(string key)
{
if (HttpContext.Current.Session != null)
{
return HttpContext.Current.Session[key];
}
return null;
}