Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# login
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 31-Mar-12 23:09pm
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you are a starter in c#.net then i think dis code is perfectly suitable for utry this|| login using c#.net
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 503
1 George Jonsson 311
2 CPallini 290
3 OriginalGriff 139
4 Prasad Khandekar 135
0 OriginalGriff 4,623
1 CPallini 3,410
2 Sergey Alexandrovich Kryukov 2,929
3 George Jonsson 2,319
4 Gihan Liyanage 2,077


Advertise | Privacy | Mobile
Web02 | 2.8.140905.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2014
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