There's a table "Login" having values of "username" and 'password" coloumn's value in it. A login form in ADO.Net as frontend, and want to check if the value of "username and password" of form matches then the next form should be displayed. how should i do it with minimum lines of code.
From stackoverflow
-
- Do not store plain text password in the database. Never.
- The ASP.NET Login form has an OnLogin or something similar event. You need to attach a method to it.
- Query the database for the credentials of the user that tried to log in. That is:
SELECT * FROM LOGIN WHERE USERNAME = @P_USERNAME;
Then you compare the password you got from the database with the password the user entered, and you're done.
Joel Coehoorn : To clarify the apparent conflict between points one and three, you use a function like SQL Server's HashBytes() to store a HASH of the password, rather than the password itself. When the user tries to login, you also hash the credential they entered, and then compare the hashed values. -
Use the Membership provider instead. Than use the login control.
Bruno Figueiredo
-
For the least lines of code, use forms authentication and the asp login control:
0 comments:
Post a Comment