Hi,
I want to update the below config file and i am saving this file as ACE.config file
="1.0"="utf-8"
<ACE xmlns="urn:www.ace.com/services/sol/report/2.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Level> report </Level>
<Output>abc </Output>
<Name> </Name>
<Password encrypted="false" alg="2.0" pwd="PhassPhrase" required="Y">plain text</Password>
<delete> Yes</delete>
</ACE>
Here the problem i am facing is, i am not able to update the password tag if file extension is .config file if it is .xml i am able to do. Please help me out to update the password attributes and innertext of the Password Element.
<Password encrypted="false" alg="2.0" pwd="PhassPhrase" required="Y">plain text</Password>
if required value is Y then i need to update the encrypted ="True" adn pwd="pwd is encrypted" and PlainText (InnerText) to XYZ.
Note : Extension of the file should be .config
I am writting below code : to update the Password. But it's not all going into for loop
Note : Extension of the file should be
.config
XDocument xmlFile = XDocument.Load(@"D:\ACE\ConfigFiles\ACE.config");
var query = from c in xmlFile.Elements("ACE").Elements("Password")
select c;
foreach (XElement password in query)
{
if(password.Attribute("required").Value=="y")
{
password.Attribute("encrypted").Value = "true";
password.Attribute("salt").Value = "PhassPhrase";
password.Value = "EncryptedText";
}
}
xmlFile.Save(@"D:\ACE\ConfigFiles\ACE.config");
Thanks in Advacnce,
Subhash G.