I was trying to execute this code at page load and it raised this error while unloading the page.
the code which i wrote in page load is
string strCon = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString();
SqlConnection sqlcon = new SqlConnection(strCon);
The page executes fine but while unloading it raises error.