Hi,
To encrypt the configuration files there are many possible ways.
This is one of the good link
http://msdn2.microsoft.com/en-us/library/ms998280.aspx
Which deals the encryption in various ways.
Even with the ConfigurationManager class also we can do the ecnryption programatically.
While deploying the application this has to be taken care.
Thanks,
Manas
use following code to encrypt connection string
if u want to encrypt the connection string then
call this function by passingtrueparameter
likeEncryptConfig(true);
and to decryptEncryptConfig(false)
publicvoid EncryptConfig(bool IsEncrypt){
string path ="/tipsandtrics"; // ur application nameConfiguration config =WebConfigurationManager.OpenWebConfiguration(path);
ConfigurationSection appSettings = config.GetSection("connectionStrings");if (IsEncrypt){
appSettings.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");}
else
{
appSettings.SectionInformation.ProtectionProvider.Name.ToString();
appSettings.SectionInformation.UnprotectSection();
}
config.Save();
}
check at
http://groups.google.com/group/a-c-net/browse_thread/thread/cab3d7cf6d778057
0 comments:
Post a Comment