Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This code don't save username and password register by the user
I use the session to store the username ,,so when i click on change password button the system know the password for who...??!!
plz answer as soon as possible

What I have tried:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand("log1")
Dim ADD As New SqlDataAdapter
cmd.CommandType = CommandType.StoredProcedure
Dim ds As New DataSet
Dim dt As New DataTable
Dim str As String
Dim up As Byte
con.ConnectionString = "Server=.;Database=log;User Id=sa; Password=123;"
cmd.Connection = con
ADD.SelectCommand = cmd
cmd.Parameters.Add("@Username", SqlDbType.VarChar)
cmd.Parameters("@Username").Value = TxtUser.Text
cmd.Parameters.Add("@Password1", SqlDbType.VarChar)
cmd.Parameters("@Password1").Value = TxtPass.Text
con.Open()
ADD.Fill(ds, "Tabel")
'Server.Transfer("login.aspx", True)
con.Close()
Session("loaddata") = ds.Tables("Tabel")
If ds.Tables("Tabel").Rows(0)("x") = 0 Then
MsgBox("True")
'Server.Transfer("login.aspx", True)
'Response.Redirect("login.aspx")
Else
MsgBox("False")
End If
End Sub
Posted
Updated 22-Mar-16 23:24pm

1 solution

Even if that code did work, it would still be wrong!
Never store passwords in clear text - it is a major security risk. There is some information on how to do it here: Password Storage: How to do it.[^] The code is in C#. but it's pretty obvious, and you can use Code Converter | Provided by Telerik[^] to generate the equivilent VB code.
 
Share this answer
 

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