Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between connection strings in App Settings and connectionStrings configuration setting

I was wondering what is the difference in having connection strings in 2 app settings and connectionstrings? Just wanted to know technically in Visual Studio 2008 for windows authentication!

<appSettings>
    add key="ConnectionString" value="Server=198.57.2.70;Database=SalesTracking;Integrated Security=SSPI"  />       
</appSettings>

<connectionStrings>
<add name="ConnectionString" connectionString="DataSource=198.57.2.70;InitialCatalog=SalesTracking;IntegratedSecurity=True;" />
</connectionStrings>

Thanks!!

like image 980
challengeAccepted Avatar asked Oct 22 '22 05:10

challengeAccepted


1 Answers

The difference is that the connectionString section gives you strongly typed access to your connection strings through the ConfigurationManager class. It's meant for connection strings specifically.

AppSettings is meant to store general settings. You can use it to store connection strings, but I recommend not doing that since there is a specific element for it in connectionStrings

like image 100
TGH Avatar answered Nov 15 '22 10:11

TGH