creating a login form in vb express edition
I want to create a login form where the user enters a password. the user shall be able to create, change the password and delete it too. how can this be done?
[158 byte] By [
MonaVohra] at [2007-11-11 10:28:03]

# 1 Re: creating a login form in vb express edition
That's too much code to expect someone to write for you for free. When your users enter a username and password, against what do you intend to authenticate them? Frequently, authentication systems use a database to store user credentials. So the process would look like this:
Design a login form with textboxes for username and password, and a command button labeled Login. When the user clicks the Login button, open a connection to the database and query the database for something like, SELECT COUNT(*) FROM Users WHERE username = <value from username textbox> and password = <value from password textbox>. If the query returns a value greater than 0, the user exists in the database and is authenicated.
If you want this application to be highly secure, it's not a good idea to store passwords in the database plain text. Instead, you should use a hashing function, such as those available in .NET's System.Cryptogrpahy namespace, to hash the password when the user creates it and store the hash in the database. Then when the user comes back to login, hash what they type in the password textbox and compare that value with the hash stored in the database.
# 2 Re: creating a login form in vb express edition
sure i wasn't looking for someone to write code for me. - i just needed an explanation on how to go about creating this as i knew that i need to use a database which stores username and passwords but was not sure on how to query it.
# 3 Re: creating a login form in vb express edition
Here's a good introduction: http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/adodtreader.aspx
# 4 Re: creating a login form in vb express edition
thanks i'll have a look at that. by the way, if im using vb express edition, should i use sql server express edition for the DB?
# 5 Re: creating a login form in vb express edition
For demo purposes, i have created a login form where a default password is used which the user uses to login. on another form (called change password) i have three textboxes. one of these are hidden and stores the default password in it. the 2nd textbox is used to enter the current password by the user. the 3rd textbox is used to enter the new password that the user wishes to change to. when i click on a button called 'change' the password changes.
however, when the application stops running and the user wishes to login again, the default password has to be used again, instead of the new password that the user changed to. what can be done to store the new password and use this new password to login the next time the user logs in? can this be done without a database as i wish to use this login/change password for demo purposes
# 6 Re: creating a login form in vb express edition
You can store data in a database, or in a disk file, or in the Windows registry. The difficulty is, if you store the data on the user's PC they can change or delete it, so you'll have to decide how your app will behave if that happens.
I would probably use VB's My.Settings feature to save the password: http://www.google.com/search?q=vb+my.settings