‘Session’ does not exist in the current context

Use

if (HttpContext.Current == null || 
    HttpContext.Current.Session == null || 
    HttpContext.Current.Session["ShoppingCart"] == null)

instead of

if (Session["ShoppingCart"] == null)

Leave a Comment