/ Published in: C#
Just a quick down and dirty login function I use.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public void LogIn(object sender, EventArgs e) { //do login UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE; UserInfo objUserInfo = UserController.ValidateUser(0, txtUser.Text,txtPassword.Text, "DNN", "", PortalSettings.PortalName, this.Request.UserHostAddress, ref loginStatus); if (loginStatus == UserLoginStatus.LOGIN_SUCCESS || loginStatus == UserLoginStatus.LOGIN_SUPERUSER) { bool isPersistent = false; //User login UserController.UserLogin(0, objUserInfo, PortalSettings.PortalName, this.Request.UserHostAddress, isPersistent); Response.Redirect("/"); } else { //show fail... errorBox.Visible = true; } }