Try pre-pending this to session:
@System.Web.HttpContext.Current.Session
If that doesn't do it, the session object itself may just be entirely null, so it can't even check your conditions in the first place. You should first check the session object itself before checking to see if any stored session objects are null.
Session!=null