Do you avoid using duplicate connection string in web.config?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
<introEmbed body={<> Since we have many ways to use Connection String in .NET 2.0, it is probably that we are using duplicate connection string in web.config. </>} />
<connectionStrings>
<add
name="ConnectionString"
connectionString="Server=(local);
Database=NorthWind;"
/>
</connectionStrings>
<appSettings>
<add key="ConnectionString" value="Server=(local);Database=NorthWind;"/>
</appSettings>

❌ Figure: Bad example - Using duplicate connection string in web.config

Acknowledgements

Adam Cogan
Ryan Tee
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star