Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Decrypting ConnectionString
- try
- {
- Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
- ConfigurationSection section = config.GetSection("connectionStrings");
- if (!section.SectionInformation.IsProtected)
- {
- section.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider");
- config.Save();
- }
- catch (Exception ex)
- {
- }
- Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
- ConfigurationSection section = config.GetSection("connectionStrings");
- if (section.SectionInformation.IsProtected)
- {
- section.SectionInformation.UnprotectSection();
- config.Save();
- }
Add Comment
Please, Sign In to add comment