Here is a very strange problem I'm having. I built an application that is working fine. The connection string works and now I want to move the connection strings to the web.config file.
Before in my InitializeComponent Method (which Works):
nString = "Data Source=servername; Initial Catalog=dbsystemodbc; Persist Security Info=True;User ID=sa;Password=MyPassword"
Now I changed it and placed the following in my webconfig:
value= "Data Source=servername; Initial Catalog=dbsystemodbc; Persist Security Info=True;User ID=sa;Password=MyPassword"
I then changed my InitializeComponent to the following
nString = WebConfigurationManager.Ap
But this does not work. It fails on the sqlConenctionDatabase.Open
I have looked at what is returned by the WebConfigurationManager.Ap
pSettings and it looks exactly like the direct string I placed in the connnectionstring property. But if I compare the two strings, the system returns that they are not the same. Also used the ConfigurationSettings.AppS
], and got the same results.
Why is this not working? Are there control characters placed in the output of the AppSettings?
My next step is to encrypt, but I cant even get the clear text version from AppSettings to work.