XML Files
Create Xml File then use the below code to access.
C# Codings
int i, j;
string users_pass = string.Empty;
string users_fail = string.Empty;
XmlDocument xml_document = new XmlDocument();
xml_document.Load(Server.MapPath("Login_Details.xml"));
XmlNodeList node_list = xml_document.GetElementsByTagName("username");
for ( i = 0; i < j =" 0;" user_name="node_list[i].ChildNodes[0].InnerText;" pass_word="node_list[i].ChildNodes[1].InnerText;" pass_count =" pass_count" pass_username =" user_name.ToString();" fail_count =" fail_count">= 1)
{
string date = System.DateTime.Now.ToShortDateString();
string date_format = date.Replace('/', '-');
string path = "Login_info_" + date_format.ToString() + ".XML";
XmlDocument xml_doc = new XmlDocument();
xml_doc.Load(Server.MapPath(path));
XmlNode xml_sel = xml_doc.SelectSingleNode("Login_Details");
XmlElement xml_ele = xml_doc.CreateElement("Login_Info");
xml_ele.SetAttribute("user_login", pass_username.ToString());
xml_sel.AppendChild(xml_ele);
xml_ele.SetAttribute("login_time", System.DateTime.Now.ToString());
xml_sel.AppendChild(xml_ele);
xml_doc.Save(Server.MapPath(path));
Response.Write("System pass :"+pass_username.ToString());
pass_count = 0;
}
else
{
Response.Write("System Fails :"+pass_username.ToString());
fail_count = 0;
}
No comments:
Post a Comment