954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

hi

i m new in asp.net with c# .I am trying to make a C# application login on my ASP.NET page.I want the code for log In.

sadiyarani
Newbie Poster
1 post since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

hi..well first you need to create a table in database to be able to maintain the users who can log in...
in your application connect to the database and try the following code at your Login button..

OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDb.4.0; Data Source=F:\\QMGT.mdb;");
OleDbCommand com = new OleDbCommand("select UserId,Password From Users", con);
OleDbDataReader rd;
con.Open();
rd = com.ExecuteReader();
if (rd.HasRows)
{
while (rd.Read())
{

string s1 = rd[0].ToString();
string s2 = rd[1].ToString();
if (s1 == txtUserID.Text && s2 == txtPassword.Text)
{
Response.Redirect("Default2.aspx");
}
else
{
Label1.Text = "UserID,Password does not match Please Try again!!";
}
}

Poojasrivastava
Newbie Poster
13 posts since Apr 2009
Reputation Points: 11
Solved Threads: 0
 
i m new in asp.net with c# .I am trying to make a C# application login on my ASP.NET page.I want the code for log In.


you dont even need code for login. on the tool box you have createuserwizard and the others. use them instead.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You