Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir,

am new to Windows Application.

am confused to create login page in c#.

i have Usename - Textbox
Password - Textbox

Login


Please can u suggest me..and explain me in detail.


Thanks,
Posted

If this is a windows application, then don't use the term "page" - use "form" instead. "Page" implies a website is involved, which is not the case for windows applications.

The first thing to do is create a database table:
ColumnName   Type
ID           Varies - some like integer, with identity set on. Personally, I prefer GUID.
Username     NVARCHAR - maximum length will depend on you, but 256 is a fair compromise.
Password     VARBINARY(64)


You may need other columns.
You will then need to make a form, with two text boxes: tbUserName and tbPassword - the latter should have the UseSystemPasswordChar property set to true. It will also need two buttons: OK and Cancel.
Then add two public properties:
C#
public string UserName
   {
   get { return tbUserName.Text; }
   set { tbUserName.Text = value; }
   }
public byte[] Password
   {
   get { return GetSHA1(UserName, tbPassword.Text); }
   }
You will find the Method GetSHA1 in this Tip: Password Storage: How to do it.[^] along with an explanation of why to use it.

When the user clicks the OK button, check the username and password against those stored in your DB: I assume you know how to fetch things from SQL. Again, there is a method in the Tip for comparing them.

You will need to add a couple of other forms as well: create user, change password, lost password, delete user are the most common - but if you get the above working they should be pretty easy.
 
Share this answer
 
If you are a starter in c#.net then i think dis code is perfectly suitable for utry this|| login using c#.net
 
Share this answer
 
v2

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