Click here to Skip to main content
13,345,744 members (49,607 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear Sir,

am new to Windows Application.

am confused to create login page in c#.

i have Usename - Textbox
Password - Textbox


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

Posted 1-Apr-12 0:09am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you are a starter in then i think dis code is perfectly suitable for utry this|| login using

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100