daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top