encryption - Encrypting elmah section of web.config file -
how can encrypt elmah section of web.config file, smtp server & login information protected?
i've learned how encrypt connection strings, appsettings , other sections; using code or aspnet_regiis.exe.
however, when try , encrypt section, tells me section not found.
is there trick encrypting it?
thanks, +m
the information above correct (that need target "errormail" or specific sub-section of elmah group). however, solution more code needed...
here's cleaner solution using "elmah/errormail". solution:
string section = "elmah/errormail"; configuration config = webconfigurationmanager.openwebconfiguration(httpruntime.appdomainappvirtualpath); // let's work section configurationsection configsection = config.getsection(section); if (configsection != null) // encrypt section if not protected if (!configsection.sectioninformation.isprotected) { // encrypt <connectionstrings> section using // dataprotectionconfigurationprovider provider configsection.sectioninformation.protectsection("dataprotectionconfigurationprovider"); config.save(); }
Comments
Post a Comment