Monday, August 11, 2014

Login Control

I've been using this code for login for the last 3years and have no idea where I found it but found a similar tutorial that shows most if not all of it:

 private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
        {
            bool boolReturnValue = false;
            string connStr = ConfigurationManager.ConnectionStrings["standdsConnectionString"].ConnectionString;
            SqlConnection Con = new SqlConnection(connStr);
            String strSQL = "Select * from tblUserAccounts";
            SqlCommand command = new SqlCommand(strSQL, Con);
            SqlDataReader Dr;
            Con.Open();
            Dr = command.ExecuteReader();
            while (Dr.Read())
            {
                if ((UserName == Dr["strUserName"].ToString()) & (Password == Dr["strPassword"].ToString()))
                {
                    TypeID = Convert.ToInt32(Dr["strTypeID"].ToString());
                    boolReturnValue = true;
                }
            }
            Dr.Close();
            return boolReturnValue;
        }

Here the link to one with more details:

I know that at some point I will need to use the 2013 control along with the OWIN login option and hopefully I can figure out how to apply that to our present database by then

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.