Format of the initialization string does not conform to specification starting at index 0

Format of the initialization string does not conform to specification
starting at index 0

Web.config :

<connectionStrings>
    <add name="TestDataConnectionString" connectionString="Data Source=.\SQLExpress;Initial Catalog=TestData;User ID=satest;Password=satest"
     />
  </connectionStrings>

In aspx.cs Page the code must be written in the below format :

SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["TestDataConnectionString"].ToString());

Leave a Comment