i want to give administrator of my website the privilege to change his password tht is stored in xml.the administrator types the new password in "NewPass.Text" and then retype the password in "ConfirmNewPass.Text". We have successfully compared the condition in the "IF" statement.The problem is inserting the password into xml(underlined).Please correct me how to insert the password into xml.
here is the piece of code.
string strFilePath = "F:\\Project\\XMLFile.xml";
XmlTextWriter write = new XmlTextWriter(strFilePath,System.Text.Encoding.UTF8);
XmlTextReader xr = new XmlTextReader(strFilePath);
XmlDocument adm = new XmlDocument();
adm.Load(xr);
XmlNode nod = adm.FirstChild.NextSibling.FirstChild.FirstChild.NextSibling;
string a = nod.InnerText;
if (NewPass.Text == ConfirmNewPass.Text)
write.WriteElementString(nod.InnerText, NewPass.Text);
Response.Write("");
Loading

Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 14, 2010, 8:36 PM EDT
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"D:\Muthu\Tech\Blogs\ListView\App_Data\XMLFile.xml");
XmlNode node = xmlDoc.SelectSingleNode(@"/Administrator/Admin/Password");
node.InnerText = "NewPassword";
xmlDoc.Save(@"D:\Muthu\Tech\Blogs\ListView\App_Data\XMLFile.xml");
syed amjad139 reputationPosted Jun 14, 2010, 6:21 AM EDT
You can modify the xml attributes value in silverlight by using method called SetAttributeValue("Attributename", "Its new value")
Example:
SetAttributeValue("firstname","Syed Amjad")
Kapil Deo MalhotraRank #2,120 · 672 reputationPosted Jun 14, 2010, 11:10 AM EDT
Can you please post your XML structure? Where you want to store user name and password? It is the node value or it is in attribute.
I can provide you with the correct solution then.
ariez34 reputationPosted Jun 14, 2010, 7:46 PM EDT
this is my XML structure.
i want to store the password in the
<Administrator>
<Admin>
<Userid>AdministratorUserid>
<Password>adminPassword>
Admin>
Administrator>
ariez34 reputationPosted Jun 14, 2010, 11:47 PM EDT