c# - How to control a log in -


so created custom generated file lets me take username , password.
following:

public user getuserbyusernamepassword(string username, string password) {    return (_databasecontext.users.firstordefault(user => user.username == username && user.password ==password)); } 

in login page have webusercontrol contains 2 textboxes, 1 password , other 1 username. created object data source webusercontrol take in parameters username , password .

what's c# code can let me check if username , password valid (i have table called user btw has 3 columns, userid(pk), username , password.

any appreciated.

ok, 3 step process

  1. you have check whether username , password submitted not null
  2. you have use foreach loop whole database , match user id user id submitted user, same goes password
  3. you have notify user success or failure.

tip: donot go near database if username or password null, otherwise exposing database hackers.


Comments