The right way to call connectionstring is from Web.config. Either using appSetting section or in ConnectionString section
e.g:
in web.config:
<appSettings>
<add key="myConnectionString" value="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</appSettings>
<connectionStrings>
<add name="myConnectionString" connectionString="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</connectionStrings
on page:
String ConnStr= "";
ConnStr= System.Configuration.ConfigurationManager.AppSettings[key];
conn = new SqlConnection(ConnStr)
con = new SqlConnection();
con.ConnectionString =ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
After these changes if you still get the same issue then please write here, will try to figure that out.
Thanks