title: How to read connection string in .NET Core?
body: <p>I want to read just a connection string from a configuration file and for this add a file with the name "appsettings.json" to my project and add this content on it:</p>
  
  <pre><code>{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-
  
   WebApplica71d622;Trusted_Connection=True;MultipleActiveResultSets=true"
    },
      "Logging": {
      "IncludeScopes": false,
      "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
     }
   }
  }
  </code></pre>
  
  <p>On ASP.NET I used this:</p>
  
  <pre><code> var temp=ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
  </code></pre>
  
  <p>Now how can I read "DefaultConnection" in C# and store it on a string variable in .NET Core?</p>