Hi every one,Could you help me in creating one login page,in which the username and password get validate with the backend db(sql server)And the password is encrypted and stored in db.So I want to know how to encrypt the user inputting password and validate that one against the encryted password in db.?I want the full code...Its an immediate one....!Please help me to create....

Recommended Answers

All 17 Replies

Sorry.

We do not do your work for you. Please post some code, and we'll help troubleshoot it.

Incidentally, if you search our forums, you'll probably find some examples of an ASP.NET login page.

Sorry.

We do not do your work for you. Please post some code, and we'll help troubleshoot it.

Incidentally, if you search our forums, you'll probably find some examples of an ASP.NET login page.

well, maybe you could me some links on tutorials you know..thanks

You can use Form Authentication mode and give the connection string representing your database.Using form Authentication you can able to send userdata to db verified it and return the msg from database. Just you have to change your config file.

Hi every one,Could you help me in creating one login page,in which the username and password get validate with the backend db(sql server)And the password is encrypted and stored in db.So I want to know how to encrypt the user inputting password and validate that one against the encryted password in db.?I want the full code...Its an immediate one....!Please help me to create....

Hi every one,Could you help me in creating one login page,in which the username and password get validate with the backend db(sql server)And the password is encrypted and stored in db.So I want to know how to encrypt the user inputting password and validate that one against the encryted password in db.?I want the full code...Its an immediate one....!Please help me to create....

u design the form in design view by inserting the table with 5 or 6 rows and two columns.then from toolbox in the view sub menu drad and drop lebels,textboxes and buttons and set their property

commented: Don't spam. -1

There was a well written example of a login screen posted on these boards very recently.

As alc6379 mentioned, the policy at Daniweb is to show that you have made an effort before posting your problems. We will gladly offer you guidance and fixes to get your code working, but you need to do the ground work first. Especially with a topic as common as this, there are a hudnred and one tutorials, just put "C# login form" into google and start reading :)

send me sourced code of login page in .net

plz tell me the way of creating a registration page in c#....?????

Please my problem has brought me to the good community of yours. i 've been try to write asp.net /c# code to validate user input 'pin' on the textbox in the sql database. if the pin is exist in the dbs then i delet it from the table it exist and insert it another table. only validation has been giving me sleepless night.
pls even though am new, ijust need the help of brothers. pls somebody help me out. here is the code i have been trying to work on my submit button:
DataTable pinTable = new DataTable();
try
{
SqlConnection connection = null;
string conn = ConfigurationManager.ConnectionStrings["SchooldataConnectionString1"].ConnectionString;
string found = "SELECT * FROM Allpindbs";
connection = new SqlConnection(conn);
connection.Open();
SqlDataAdapter dAdapter = new SqlDataAdapter();
dAdapter.SelectCommand = new SqlCommand(found, connection);
dAdapter.Fill(pinTable);
connection.Close();

}
catch (Exception ERR)
{

throw ERR;
}
foreach (DataRow oRow in pinTable.Rows)
{
PinCode.CompareTo(oRow["Pin"].ToString());
}
if (PinCode.CompareTo("Pin".ToString()) == 0)
{
MessageBox.Show("pin must be deleted");
}
else
{
MessageBox.Show("Invalid pin");
}
}
private void clearControls()
{
this.txtFullName.Text = " ";
this.txtRegNumber.Text = " ";
this.txtPinCode.Text = " ";
this.ddlGender.Text = " ";
this.txtLbl.Text = " ";
this.txtpassword.Text = " ";
}

}

DataTable pinTable = new DataTable();
        try
        {
            SqlConnection connection = null;
            string conn = ConfigurationManager.ConnectionStrings["SchooldataConnectionString1"].ConnectionString;
            string found = "SELECT * FROM Allpindbs";
            connection = new SqlConnection(conn);
            connection.Open();
            SqlDataAdapter dAdapter = new SqlDataAdapter();
            dAdapter.SelectCommand = new SqlCommand(found, connection);
            dAdapter.Fill(pinTable);
            connection.Close();

        }
        catch (Exception ERR)
        {

            throw ERR;
        }
        foreach (DataRow oRow in pinTable.Rows)
        {
            PinCode.CompareTo(oRow["Pin"].ToString());
        }
        if (PinCode.CompareTo("Pin".ToString()) == 0)
        {
            MessageBox.Show("pin must be deleted");
        }
        else
        {
            MessageBox.Show("Invalid pin");
        }
    }
    private void clearControls()
    {
        this.txtFullName.Text = " ";
        this.txtRegNumber.Text = " ";
        this.txtPinCode.Text = " ";
        this.ddlGender.Text = " ";
        this.txtLbl.Text = " ";
        this.txtpassword.Text = "    ";
    }

}

Firstly, you are looping through each row but not storing the result of your test anywhere. I would suggest something like:

bool found = false;
foreach(DataRow dr in Table.Rows)
{
    if(dr["column"].ToString() == "somestring")
    {
        found = true; //store result
        break; //exit foreach loop as you no longer need to search remaining items
    }

    if(found)
    {
        //perform action based on result
    }
}

Secondly, you are using the wrong string method. IF you take a look at the msdn reference, you'll find:

Caution!

The CompareTo method was designed primarily for use in sorting or alphabetizing operations. It should not be used when the primary purpose of the method call is to determine whether two strings are equivalent. To determine whether two strings are equivalent, call the Equals method.

You can use Form Authentication mode and give the connection string representing your database.Using form Authentication you can able to send userdata to db verified it and return the msg from database. Just you have to change your config file.

i tell you what i am doing

i have created a table in database that keeps username and passwords but my problem is how that table is made protected because from where i had installed sql server, thats a server and many students can work on the database as it is their subject.
is there some method so that any one can not see my database. is there some password property that could be applied to the sql server database

u can use login tool from the login tool box.....

&

also u can do the coding in c sharp.

whtr u doing people plz i informed u after some bcoz now i m busy in my project

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.