Click here to Skip to main content
15,889,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
So I created a custom generated file that lets me take the username and password.
It is the following:
C#
public User GetUserByUserNamePassword(string userName, string Password)
{
   return (_DatabaseContext.Users.FirstOrDefault(user => user.Username == userName && user.Password ==Password));
}

In my log in page I have a webUserControl that contains two textboxes, one for the password and the other one for the username. I created an object data source for the webusercontrol to take in parameters Username and password .

Whats the c# code that can let me check if the username and password are valid (I have a table called User btw that has three columns, UserID(pk), Username and Password.
Posted
Updated 18-Jul-13 22:29pm
v2

I solved the problem, I just have to work on my DataSourceObject.Select() .
If it returns null , then data not valid. But if The entries are correct , it returns the object which in this case it's a user .

Thanks for your help!
 
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