Do not use ToString () if you want to check if Session ["company_path"] is null. Like if Session["company_path"] is null then Session["company_path"].ToString() will give you exception.
Edit
if (System.Web.HttpContext.Current.Session["company_path"].ToString() != null) { company_path = System.Web.HttpContext.Current.Session["company_path"].ToString(); } else { company_path = "/reflex/SMD"; }
For
if (System.Web.HttpContext.Current.Session["company_path"]!= null) { company_path = System.Web.HttpContext.Current.Session["company_path"].ToString(); } else { company_path = "/reflex/SMD"; }
Adil
source share