W
WT
Hello,
I am trying to update a configuration section for my web.config with
SetRawXml withoutr result.
I have given modfidy rigth to Network Services account which is running the
..NET2 pool in wich my application is running, here is my code:
System.Configuration.Configuration config =
(System.Configuration.Configuration)WebConfigurationManager.OpenWebConfiguration("~");
ConfigurationSection appSettings = config.AppSettings;
if (appSettings != null)
{
if (!appSettings.SectionInformation.IsProtected)
{
if (!appSettings.ElementInformation.IsLocked)
{
appSettings.SectionInformation.SetRawXml(AppSettingsXml.Text);
}
else
System.Diagnostics.Trace.WriteLineIf(ModuleTraceSwitch.Sw.TraceVerbose,
string.Format("Can't update, section {0} is locked ",
appSettings.SectionInformation.Name));
}
else
{
System.Diagnostics.Trace.WriteLineIf(ModuleTraceSwitch.Sw.TraceVerbose,
string.Format("can't update, section {0} is protected by
{1}",appSettings.SectionInformation.Name,appSettings.SectionInformation.ProtectionProvider.Name));
}
// Save the encrypted section.
appSettings.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Full);
After this no change in Web.config ?
Any idea on my error welcome.
CS
I am trying to update a configuration section for my web.config with
SetRawXml withoutr result.
I have given modfidy rigth to Network Services account which is running the
..NET2 pool in wich my application is running, here is my code:
System.Configuration.Configuration config =
(System.Configuration.Configuration)WebConfigurationManager.OpenWebConfiguration("~");
ConfigurationSection appSettings = config.AppSettings;
if (appSettings != null)
{
if (!appSettings.SectionInformation.IsProtected)
{
if (!appSettings.ElementInformation.IsLocked)
{
appSettings.SectionInformation.SetRawXml(AppSettingsXml.Text);
}
else
System.Diagnostics.Trace.WriteLineIf(ModuleTraceSwitch.Sw.TraceVerbose,
string.Format("Can't update, section {0} is locked ",
appSettings.SectionInformation.Name));
}
else
{
System.Diagnostics.Trace.WriteLineIf(ModuleTraceSwitch.Sw.TraceVerbose,
string.Format("can't update, section {0} is protected by
{1}",appSettings.SectionInformation.Name,appSettings.SectionInformation.ProtectionProvider.Name));
}
// Save the encrypted section.
appSettings.SectionInformation.ForceSave = true;
config.Save(ConfigurationSaveMode.Full);
After this no change in Web.config ?
Any idea on my error welcome.
CS