Guest User

Untitled

a guest
Aug 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Decrypting ConnectionString
  2. try
  3. {
  4. Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
  5. ConfigurationSection section = config.GetSection("connectionStrings");
  6. if (!section.SectionInformation.IsProtected)
  7. {
  8. section.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider");
  9. config.Save();
  10. }
  11. catch (Exception ex)
  12. {
  13.  
  14. }
  15.  
  16. Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
  17. ConfigurationSection section = config.GetSection("connectionStrings");
  18. if (section.SectionInformation.IsProtected)
  19. {
  20. section.SectionInformation.UnprotectSection();
  21. config.Save();
  22. }
Add Comment
Please, Sign In to add comment