Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
        private void btn_Giris_Click(object sender, EventArgs e)
        {
            try
            {
                USER usr = DB.USERs.First(s => s.USERNAME == txtUserName.Text && s.PASSWORD == txtPassword.Text);
                if (usr.ISACTIVE == true)
                {
                    usr.ISONLINE = true;
                    DB.SubmitChanges();
                    Classes.ClsUser.UserName = usr.USERNAME;
                    Classes.ClsUser.UserID = usr.USERID;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Aktif Degilsin", "ADMIN", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {

                MessageBox.Show("kullanici adi veya parola hatasi");
            }
        }

What I have tried:

private void Parola_Animsa()
        {
            if (!Directory.Exists(Application.StartupPath + "\\Pasword")) 
            {
                Directory.CreateDirectory(Application.StartupPath + "\\Pasword");
            }

            string possibleFileName = (Application.StartupPath + "\\Pasword\\" + Classes.ClsUser.UserName + "#Public" + ".EdL");
            if (File.Exists(possibleFileName))
            {
                string content = File.ReadAllText(possibleFileName);
                txtPassword.Text = content;
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            Parola_Animsa();
        }
Posted
Updated 19-Sep-18 2:42am
v2
Comments
CHill60 19-Sep-18 7:38am    
What is the problem?
erdalczr 19-Sep-18 7:45am    
I want to make a messaging application. Do you have a password in the login entry for the user to do this?
CHill60 19-Sep-18 7:51am    
Password for what ... your application? No!
Your question or problem is not at all clear. Try to explain it better, use Google Translate if need be
erdalczr 19-Sep-18 7:57am    
:) I use the translate I do not know much english. I have saved username and password in mysql. I want the user to login when I want to remember the password to the application. don't have to enter a password every time. I wanted to do it with a checkbox but it didn't.

1 solution

Storing the password on a database is not a good idea...
See these articles:
The Art & Science of Storing Passwords[^]
Password Storage: How to do it.[^]

For "auto logon" There are specific windows options e.g. use Windows Authentication - Authenticating Users with Windows Authentication (C#) | Microsoft Docs[^] - and then enabling Autologon - Autologon - Windows Sysinternals | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900