Last post Aug 20, 2013 04:28 AM by p.pooja10
Aug 20, 2013 12:26 AM|gani7787|LINK
I have migrated server windows 2003 to windows server 2008.
I have used all the connection string in machine.config only. This will be working in Windows server 2003.
After migrating of the server, Connection string not refering in Machine.config.
I am getting below error.
"The connection name 'ConnEmp' was not found in the applications configuration or the connection string is empty."
It will take only web.config only.
But, i want to mention all my connection string in machine.config for security purpose.
what settings i want to do...?
Aug 20, 2013 02:30 AM|romy.thomas|LINK
It will be better if you can store all application related configuration in your web.config or app.config file. Becuase machine,config is machine wide config file and ideally it should not contain any app related configurations.
For security purpose, you can have encrypted the connection strings in web.config
Aug 20, 2013 04:08 AM|bmwz9|LINK
It's better to store connection strings in web.config or app.config and encrypt config
Aug 20, 2013 04:28 AM|p.pooja10|LINK
Check whether you web.config has a <clear/> in the connectionStrings.
Be defining it in the machine.config it should be global, unless you have in your applications cleared it out.
below is the code to access connection string from machine.config
Configuration machineConfig = ConfigurationManager.OpenMachineConfiguration();
foreach (ConnectionStringSettings connectionstring in machineConfig.ConnectionStrings.ConnectionStrings)
// u can have multiple connection strings
// read the connection string here