you can call the connection string inside class file and call it in page like:-
in class file write a function
public static string strcon = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString.ToString();
public static SqlConnection OpenConnection()
{
try
{
SqlConnection cn = new SqlConnection(strcon);
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
return cn;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
just create object of this class and call this method you will make a connection