all groups > asp.net security > january 2004 >
You're in the

asp.net security

group:

Login-Validating(ASP.NET) against a DB


Login-Validating(ASP.NET) against a DB Naijaacoder
1/29/2004 11:03:18 AM
asp.net security:
I'm looking for an ASP.NET(login page) that validates against a database.
And after succesful logon ..PRINT the USERS name on the Page(Session)!!
Can anybody help?

___
Re: Login-Validating(ASP.NET) against a DB John G.
1/30/2004 2:33:21 PM
Here's one article.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT03.asp
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


[quoted text, click to view]
RE: Login-Validating(ASP.NET) against a DB David Coe
2/2/2004 7:46:12 AM
You can take the user ID/password and compare them to what you have in the database. If an item is found that is matching, grab the user name (ie, David) from the database, and display the name in a label. If the name is something that you want to persist across pages, then you could store the name in a session variable and then display it on several pages across the app.

int iUser = 0;
SqlDataReader reader = myCommand.ExecuteReader();

while(reader.Read())
{
myLabel.Text = reader["FirstName"].ToString();
// Session["UserFirstName"] = reader["FirstName"].ToString();
}

if (iUser == 0)
// in valid user id/password
else
AddThis Social Bookmark Button