Click here to Skip to main content
15,032,063 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

i need simple login page for using c# with
S@53K^S 23-Apr-12 10:52am
Use the default one that comes with the ASP.NET application.It works good for a simple login page

Start here[^]. I mean, really, at least give it a go first before asking for an out-of-the-box solution.
Look here:
Traditional Login page design discussion[^]

Login Controls were released by Microsoft, have a look at them here[^].
For, building Login Page using Login control, look:
How to: Create an ASP.NET Login Page[^]
ASP.NET Login Controls Overview[^]
How to add a Login, Roles and Profile system to an ASP.NET 2.0 [^]

If needed, pick any example from here: Google Search result on the same[^].
protected void Login_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection("Data Source=SYSTEM1;Initial Catalog=master;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
string sql;
sql = "select *from user1 where uname ='" + TextBox1.Text + "' and pwd = '" + TextBox2.Text + "'";
cmd.CommandText = sql;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
StianSandberg 24-Jul-12 5:55am
This is a solution is vulnerable to sql-injections! And it's a solution where you store passwords as clear text in your database.
If someone types "'; DELETE FROM user1 WHERE ''='" in TextBox2, then your table is wiped out.

Please read my article about storing passwords and sql-injections

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