<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="ServerName" value="localhost" />
<add key="DatabaseName" value="amc_live" />
<!--<add key="PwdName" value="123456" />-->
<add key="LogError" value="1" />
</appSettings>
<secureAppSettings>
<add key="UserName" value="root" />
<add key="Password" value="12345" />
</secureAppSettings>
here in the above code... after encrypt of securityAppSetting i cant able to update that programatically .
i use below code to update
xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
xmlDoc.SelectSingleNode("//secureAppSettings/add[@key='Password']").Attributes["value"].Value = Pass;
xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
ConfigurationManager.RefreshSection("secureAppSettings");
but in below line of code it is throwing error like "Object reference not set to an instance of an object." when i try to update.
xmlDoc.SelectSingleNode("//secureAppSettings/add[@key='Password']").Attributes["value"].Value = Pass;
Thanks.