public Boolean AuthenticateUserCredential(String userName, String passWord, int groupFlag) { bool authenticate = false; string fLocation = null; if (groupFlag == MEMBER_XML) { fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\" + memberCredentialFile); } else { fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data\" + staffCredentialFile); } if (System.IO.File.Exists(fLocation) && userExists(userName, groupFlag)) { SecretHash hash = new SecretHash(); String passwordHash = hash.getHashValue(passWord); FileStream fStream = new FileStream(fLocation, FileMode.Open); XmlDocument doc = new XmlDocument(); doc.Load(fStream); fStream.Close(); XmlNodeList nodeList = doc.SelectNodes("/credentials/user/username"); foreach (XmlNode node in nodeList) { if (node.InnerText.Equals(userName) && node.NextSibling.InnerText.Equals(passwordHash)) { authenticate = true; } } } return(authenticate); }
protected void btnGetHash_Click(object sender, EventArgs e) { SecretHash obj = new SecretHash(); txtHashOutput.Text = obj.getHashValue(txtInput.Text); }