ASP.NET C# Help me fix member sign up code

Hi, I wrote the following code.
I get no compiler errors, but it doesn't work either.
it is supposed to:
Check form values against records in an .xml db file and if not found,
add the values as a new record, and then send a email to the address submitted by the form.
After which it will set some session variables and redirect.

private void btnSend_Click(object sender, Systemail.EventArgs e){
string bodymessage;
bodymessage="All the body stuff here;

  string name;
  string email;
  XmlDocument doc = new XmlDocument();
  doc.Load(Server.MapPath("xmlfile.xml") );
  XmlElemailent root = doc.DocumentElemailent;
  XmlNodeList nodes = root.SelectNodes("/memailber");
 // You can filter elements here using XPath
  foreach (XmlNode node in nodes){
    if (node["email"].InnerText == email){
     lblStatus.Text = "Member already exists";
      //user not found so insert the data
      node["name"].InnerText =name ;
      node["email"].InnerText= email;
    //send email
      MailMessage msg = new MailMessage();
      msg.To = email;
      msg.From = "";
      msg.Subject = "something";
      msg.Body = bodymessage;
      //set session vars

      Session["thissession"] = name;
      Session["thissessionvar"] = 1;



Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dotinfinitiAuthor Commented:
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.Xml" %>
did you set breakpoints in your code to see what is executed and what is not?
Check this article that authenticates user agains xml:
dotinfinitiAuthor Commented:
The above code works, except that it doesn't insert the data into the xml file.
The check for duplicates and  send mal work fine
dotinfinitiAuthor Commented:
Thanks guru, but I fixed it myself with the following:

First I changed this line \/
        XmlNodeList nodes = root.SelectNodes("/parent");
With this line \/
        XmlNodeList nodes = root.SelectNodes("/root/parent");

This area \/
      //user not found so insert the data
      node["name"].InnerText =name ;
      node["email"].InnerText= email;

was replaced with this \/
        XPathNavigator xn = doc.CreateNavigator();

It helps if you append the information and  save the document  :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.