title: How to validate ConnectionString exists and if not do not throw error
body: <h3>The connection name 'MySqlServer' was not found in the applications configuration or the connection string is empty.</h3>
  
  <p>So, I have a page with a panel that will display when the connection in the web config is found and the connection is valid; using a try/catch as long as the add name"VALUE" is in the config connection strings if the server data is bad the page will load and the panel is set to invisible... I need to be able to handle the following...</p>
  
  <p>If the named value in this case MySqlServer is used in the aspx; aspx.cs but not found in the config I do not want the error to occur; connection name was not found.... I just want to not show the panel like when the SqlConnection.Open fails when the name is found but data is bad...</p>
  
  <p>aspx</p>
  
  <pre><code>   &lt;asp:SqlDataSource runat="server" ID="allowedIPsSqlDataSource" 
      ConnectionString="&lt;%$ ConnectionStrings:MySqlServer %&gt;"
  </code></pre>
  
  <p>aspx.cs</p>
  
  <pre><code>string connectionString = ConfigurationManager.ConnectionStrings["MySqlServer"].ToString();
          SqlConnection SqlConnection = new SqlConnection(connectionString);
          SqlCommand SqlCommand = new SqlCommand();
          try
          {
              SqlConnection.Open();
  </code></pre>
  
  <p>config</p>
  
  <pre><code>&lt;connectionStrings&gt;
          &lt;add name="NotMySqlServer" providerName="System.Data.SqlClient" connectionString="server=TEST\SQL2005;database=ADB;Integrated Security=True"/&gt;
  &lt;add name="NotMy2SqlServer" providerName="System.Data.SqlClient" connectionString="server=TEST\SQL2005;database=ADB;Integrated Security=True"/&gt;
  
      &lt;/connectionStrings&gt;
  </code></pre>