how to use change the security question and answer

Discussion in 'ASP .Net Security' started by Roberto Kohler, Aug 22, 2006.

  1. 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 Kohler, Aug 22, 2006
    1. Advertisements

  2. FYI, this is how you do it:

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

    If (result = True) Then
    Msg.Text = "Password Question and Answer changed."
    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
    Roberto Kohler, Aug 24, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.