I have a console application and it has app.config. When I run this code:
class Program { static void Main() { ConnectionStringsSection connSection = ConfigurationManager.GetSection("connectionStrings") as ConnectionStringsSection; if (connSection != null) { if (!connSection.SectionInformation.IsProtected) connSection.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider"); else connSection.SectionInformation.UnprotectSection(); } Console.Read(); } }
I get an error: "This operation does not apply at runtime." I also tried to grant permissions for my app.config, but no luck.
What is the problem?
Jaggu source share