Wednesday, February 4, 2015

Reading the Config File from a DLL

I was having some trouble with the connection string in a DLL. This fixed it for me. https://www.connectionstrings.com/store-connection-string-in-webconfig/ Connection string in .NET 3.5 (and above) config file Do not use appsettings in web.config. Instead use the connectionStrings section in web.config. To read the connection string into your code, use the ConfigurationManager class. string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

No comments:

Post a Comment