Return to Snippet

Revision: 59429
at September 7, 2012 04:57 by box86rowh


Initial Code
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;
        }
    }

Initial URL

                                

Initial Description
Just a quick down and dirty login function I use.

Initial Title
Easy login method for DNN based web sites

Initial Tags
login, c#

Initial Language
C#