Hi.
I've been trying to encrypt the AppSettings section of the Web.Config file using the following code in the Application_Start event-handler, but it generates an exception. Is my code correct, or is it some other problem (e.g. my app doesn't have permission to modify its own config file).
Is there some other way of achieving this?Code:Configuration config = WebConfigurationManager.OpenWebConfiguration(null); SectionInformation secInfo = config.GetSection("appSettings").SectionInformation; if (!secInfo.IsProtected) { secInfo.ProtectSection("DataProtectionConfigurationProvider"); secInfo.ForceSave = true; config.Save(); }
Best wishes,
Simon.


Reply With Quote


Bookmarks