The problem is even the Session is empty it also dose not show up the grid if (Session["User"] != null) { GridView1.Visible = false; } else { GridView1.Visible = true; }