how to use change the security question and answer

R

Roberto Kohler

I would like to allow users to change their security question and answer in
much the same way they are allowed to change their password.

I thought the ChangePassword control would allow them to also change their
security question and answer but apparently it does not.

Is there a way to do that?

Any help would be greatly appreciated.

Roberto
 
R

Roberto Kohler

FYI, this is how you do it:

Public Sub ChangePasswordQuestion_OnClick(ByVal sender As Object, ByVal args
As EventArgs)
Try
Dim u As MembershipUser = Membership.GetUser(User.Identity.Name)
Dim result As Boolean
result = u.ChangePasswordQuestionAndAnswer(PasswordTextbox.Text, _
QuestionTextbox.Text, _
AnswerTextbox.Text)

If (result = True) Then
Msg.Text = "Password Question and Answer changed."
Else
Msg.Text = "Password Question and Answer change failed."
End If

Catch e As Exception
Msg.Text = "Change failed. Please re-enter your values and try again."
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top