0

I doing a WPF project using C# and LinQ. My application require user to login before they able to access the application. So, what i am doing is i have all the members data in mySQL server(as shown as the image below). User able to login into the application only if the "Status" is 1. So, may i know what kind method i can use for all the authentication and encryption for the login procedure? Thanks.

p/s: i am a newbie

enter image description here

Nerdynosaur
  • 1,798
  • 9
  • 32
  • 61

1 Answers1

1

Just do something like this:

   var username = txtUserName.Text;
   var password = txtPassword.Text;// there is available encryption on the web that you can use on. and your code will be like var password=enc.EncryptToString(txtPassword.Text);
   var isValidUser = from user on UserTable
                     where user.UserName == txtUserName.Text && user.Password == password && user.Status == 1
                     select user;  
   if(isValiduser.Count() > 0)
   {
     //OK you can log on
   }
   else
   {
     //user credential is invalid
   }       

For your encryption see the link below for:

Simple 2 way encryption for C#

Best Regards

Community
  • 1
  • 1
BizApps
  • 6,048
  • 9
  • 40
  • 62
  • ha, actually i did something like that. +1 for you and mark the "tick" for you if the encryption work. thanks for the quick reply C= – Nerdynosaur Dec 03 '12 at 02:45