Click here to Skip to main content
15,886,857 members

Comments by Matthew Hazlett (Top 1 by date)

Matthew Hazlett 24-Nov-10 17:45pm View    
You might want to revisit this. The entire top part of this code is not even used. You create an xml element just to blow it away a few lines later.

Then this line:
XmlNodeList credentials = xmlDocument.DocumentElement.SelectNodes("/Credentials/Credential");

Should be:
XmlNodeList credentials = xmlDocument.SelectNodes("//Credentials/Credential");

A single slash in an xPath means to return only one result. If there is only one node that ever gets returned then the foreach line under it makes no sense.

There are so many more issues with what you posted. It looks like you stole code from various sources, cut and pasted it together without really understanding anything at all about what you are doing.