How do I read a value from the web.config file for a connectionstring in the 4.5 .net framework?
I'm using system.configuration which I have a reference to and a using statement, but the only thing coming up after that to use is .ConfigurationSettings.Appsettings
.
No connectionstringsettings.
using System.Configuration;
string connectionString = ConfigurationManager.ConnectionStrings["StringName"].ConnectionString;
Edit (Adding in a reference to System.Configuration
:
Right click on your project -> Add Reference -> Select the .NET
Tab -> Select System.Configuration -> OK
http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With