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 ArigovindasamyPosted Jun 15, 2010, 12:36 AM
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");
ariezPosted Jun 15, 2010, 3:47 AM
ariezPosted Jun 14, 2010, 11:46 PM
this is my XML structure.
i want to store the password in the
<Administrator>
<Admin>
<Userid>AdministratorUserid>
<Password>adminPassword>
Admin>
Administrator>
Kapil Deo MalhotraPosted Jun 14, 2010, 3:10 PM
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.
syed amjadPosted Jun 14, 2010, 10:21 AM
You can modify the xml attributes value in silverlight by using method called SetAttributeValue("Attributename", "Its new value")
Example:
SetAttributeValue("firstname","Syed Amjad")