So I have a xml file
<?xml version="1.0" encoding="utf-8" ?>
<customers>
<customer id="1">
<username>ef</username>
<password>eefer</password>
</customer>
<customer id="2">
<username>efewf</username>
<password>ewfwf</password>
</customer>
</customers>
From a login page a customer is logged into a page and their session is stored on index page as a string like, string username = Session["username"].ToString();
and displayed on the page.
How can I change customer's password? So far I have this form:
<asp:TextBox ID="OldPass" runat="server"></asp:TextBox>
<asp:TextBox ID="NewPass" runat="server"></asp:TextBox>
<asp:TextBox ID="ConfPass" runat="server"></asp:TextBox>
<asp:Button ID="change" runat="server" Text="Button" OnClick="change_Click" />
<asp:Label ID="msg" runat="server" Text=""></asp:Label>
This code:
protected void change_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("customers.xml"));
foreach (XmlNode node in doc.SelectNodes("/customers/customer/password"))
{
String password = node.SelectSingleNode("password").InnerText;
if (...)
{
}
else
{
}
}
}
How could I change or update from an old password of the customer to new one based on the logged in session maybe? or their id? thanks
No comments:
Post a Comment