if(!string.IsNullOrEmpty(HttpContext.Current.Sessi on["UserID"].ToString()))
Yerine
if ((HttpContext.Current.Session["UserID"] != null) && (!string.IsNullOrEmpty(HttpContext.Current.Session["UserID"].ToString())))
Yapman lazım. Yani önce null kontrolü yapmalısın