Are you looking for something like this:
User Login With XML...[
^]
Since above one is in Vb, converting important snippets in C# for you.
1. Place ASP.NET Login Control on a web page.
2. XML File:
="1.0"="utf-8"
<Staff>
<User>
<username>aspxcode</username>
<password>2008</password>
</User>
<User>
<username>windows</username>
<password>vista</password>
</User>
</Staff>
3. Code behind:
protected void Login1_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
{
string username = null;
string pwd = null;
string CurrentUser = "";
string CurrentPwd = "";
bool LoginStatus = false;
username = Login1.UserName;
pwd = Login1.Password;
XmlDocument xd = new XmlDocument();
xd.Load(Server.MapPath("~/App_Data/AllUser.xml"));
XmlNodeList xnl = xd.GetElementsByTagName("User");
foreach (XmlNode xn in xnl) {
XmlNodeList cxnl = xn.ChildNodes;
foreach (XmlNode cxn in cxnl) {
if (cxn.Name == "username") {
if (cxn.InnerText == username) {
CurrentUser = username;
}
}
if (cxn.Name == "password") {
if (cxn.InnerText == pwd) {
CurrentPwd = pwd;
}
}
}
if ((!string.IsNullOrEmpty(CurrentUser)) & (!string.IsNullOrEmpty(CurrentPwd))) {
LoginStatus = true;
}
}
if (LoginStatus == true) {
Session("UserAuthentication") = username;
Session.Timeout = 1;
Response.Redirect("how-to-StartPage.aspx");
} else {
Session("UserAuthentication") = "";
}
}
Try!