Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:13:30+00:00 2026-06-08T18:13:30+00:00

I am trying to create a web application to reset the password based on

  • 0

I am trying to create a web application to reset the password based on question/answer using System.Web.Security API.

I get an exception:

DirectoryServicesCOMException (0x8007202f): A constraint violation
occurred” if user provide one bad answer to the question.

If I reset value of attributeMapFailedPasswordAnswerCount to not set the account becomes active again.

Account Lockout threshold in AD is set to 20 logon attempts.

I am novice on AD knowledge and will be grateful if someone can guide me how to solve this problem.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:13:31+00:00Added an answer on June 8, 2026 at 6:13 pm

    I’m guessing you’re using ASP.NET? I don’t really have any experience with it, nor do I have much experience with .NET in general (I’m still learning myself), but this was a really useful link providing examples of various Active Directory API’s (link). Including resetting a user password. Here is a link to the DirectoryEntry class, if you aren’t sure how to set it up (link). Plus, just browsing through the namespace documentation is very, very helpful (link). Probably the only thing I like about Microsoft is their good documentation.

    I usually do something like this (in IronPython, so it will not translate directly to code you can use):

    ou = System.DirectoryServices.DirectoryEntry("LDAP://ou=Users,dc=whatever,dc=something,dc=localetc")
    search = System.DirectoryServices.DirectorySearcher(ou, "(samAccountName="+acc"+")", Array[str](["distinguishedName"]]))
    result = search.FindAll() # note 1
    if result.Count != 1:
        raise BadError
    else:
        ent = System.DirectoryServices.DirectoryEntry(result[0].Properties["distinguishedName"][0])
        ent.Username = admin # note 2
        ent.Password = pwd
        ent.Invoke("SetPassword", Array[object](["newpassword!"]))
        ent.Properties["LockOutTime"].Value = 0
        ent.CommitChanges()
    

    Notes:

    1. If this ever returns more than one result, you have issues.

    2. this and the password are only necessary if the account running this does not have permission to change the user. I run these on an unprivelaged account so I have to include my admin credentials in the script (don’t worry, they aren’t hardcoded)

    Oh and you’re account lockout threshold is quite high. I would suggest 3-5, depending on the aptitude of your users.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a web application which will get input from system. What
I'm trying to create a web application using maven, tomcat and hibernate. Now I'm
I am trying to create a new web application using PowerShell. I keep getting
I am trying to create a web application using the MVC design pattern. For
I'm trying to create a web application using a JavaScript framework (eg Extjs) for
I'm getting an exception in Eclipse. I am trying to create web application project
I'm trying to create a web application project template for everyone to use here
I've been trying to create a stable web service application for the last 2-3
I'm trying to create an ASP.NET Web Application project in Visual Studio 2010 but
I'm trying to create a large, multi-page, PHP web application for work where a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.