Şu satır;
if(!string.IsNullOrEmpty(HttpContext.Current.Session["UserID"].ToString()))
Şöyle olacak;
if(!string.IsNullOrEmpty(HttpContext.Current.Session["UserID"]))
Null bir değere ToString uygularsanız hata alırsınız. Zaten if de null ve empty olma durumunu sorguluyorsunuz.