Change password code in asp.net with vb
hey all..i want change password code in asp.net with vb..
i wrote following code..but the thing is that the user can enter any email id or password and update it.
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim cn As New SqlClient.SqlConnection(cnstring)
Dim cmd As New SqlClient.SqlCommand
Dim sql As String
Dim vname, vpswd, vnew, vid As String
Try
vname = TextName.Text
vpswd = TextOPswrd.Text
vnew = TextNew.Text
vid = TextEID.Text
sql = "update Reg set Pswrd=@Pswrd where EID=@EID"
cn.Open()
cmd.CommandType = CommandType.Text
cmd.CommandText = sql
cmd.Connection = cn
cmd.Parameters.AddWithValue("@EID", vid)
cmd.Parameters.AddWithValue("@Pswrd", vnew)
cmd.ExecuteNonQuery()
Literal1.Text = "<b>Your password has been changed successfully</b>"
cn.Close()
Catch ex As Exception
Literal1.Text = ex.ToString
End Try
End Sub