Blank Connection String Issues
Posted on 2011-09-15
I am attempting to use a local file to store the logon information for a ASP.NET site made in C#, and I am getting an empty string returned when I attempt to use the following code to open the connection:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = WebConfigurationManager.AppSettings["SampleConnectionString"];
After I get to the conn.Open() line of code, I receive a "general error" due to the SampleConnectionString values not being read into the site. The file that contains the connection string has the following line of code within it and is called appsettings.txt:
<add key="SampleConnectionString" value="Data Source=WEB;Enlist=false;User ID=user;Password=1234;" />
Any help that can be provided about why this string, which is included in the project, is not being pulled back into the WebConfigurationManager.AppSettings call would be greatly appreciated.