| | |
How to Hash and Store in Database
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2005
Posts: 50
Reputation:
Solved Threads: 0
I am currently working to store passwords into my SQLDatabase table. I would like to hash the password columns to make it more secure. I know that i can use either SHA1 or MD5.
Refering to this website, http://www.codersource.net/csharp_sh...ncryption.html, i try to write the VB.NET codes.
Private Sub EncryptPassword()
FormsAuthentication.HashPasswordForStoringInConfigFile(txtbox_password.Text, "SHA1")
myDataset.Tables("Member").Rows(myDataIndex)("MemberPassword") = txtbox_confirmpass.Text
dtDataAdapter.Update(mydataset)
End Sub
The hashing works but i am unable to insert it into the database as the hash value. Also, Forms authentication requires me to manually copy and paste the username and password each time to store the hash to the table. I want to be able to store the hashed password to the table directly and i think i can use update statement but it isn't working, my table name is Member, the password column is MemberPassword. Would someone kindly help me. :cry:
Refering to this website, http://www.codersource.net/csharp_sh...ncryption.html, i try to write the VB.NET codes.
Private Sub EncryptPassword()
FormsAuthentication.HashPasswordForStoringInConfigFile(txtbox_password.Text, "SHA1")
myDataset.Tables("Member").Rows(myDataIndex)("MemberPassword") = txtbox_confirmpass.Text
dtDataAdapter.Update(mydataset)
End Sub
The hashing works but i am unable to insert it into the database as the hash value. Also, Forms authentication requires me to manually copy and paste the username and password each time to store the hash to the table. I want to be able to store the hashed password to the table directly and i think i can use update statement but it isn't working, my table name is Member, the password column is MemberPassword. Would someone kindly help me. :cry:
What is it that's not working? What is the error or exception you're getting?
You should be able to use the Update method to store data in the database, but your DataAdapter must be setup properly and the types and lengths of your database fields must be capable of storing the hash string. I think your problem is more about reading and writing to the database than hashing a password. Try doing some simple experiments to be sure you can use the Fill and Update methods of the data adapter in the way you expect.
You should be able to use the Update method to store data in the database, but your DataAdapter must be setup properly and the types and lengths of your database fields must be capable of storing the hash string. I think your problem is more about reading and writing to the database than hashing a password. Try doing some simple experiments to be sure you can use the Fill and Update methods of the data adapter in the way you expect.
![]() |
Similar Threads
- Store MS Word/Excell files into database system (VB.NET)
- how to convert images to binary to store in database (Java)
- How to store in to Database (VB.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: System.InvalidCastException: Specified cast is not valid
- Next Thread: Datagrid is not working that well in edit mode
Views: 5039 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net box browser button c# checkbox commonfunctions complex connection dataaccesslayer database datagridview datagridviewcheckbox datalist development dgv dropdownlist dynamically edit editing expose feedback fileuploader fill flash form formatdecimal formview google gridview gudi iframe iis javascript list listbox login microsoft migration mono mouse mssql news numerical opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail richtextbox rows save schoolproject search security select services session silverlight smartcard smoobjects software sql sql-server sqlserver2005 suse textbox theft tracking unauthorized validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers




