Solved

Can i access Default Domain Policy from C#

Posted on 2011-02-21
1
1,133 Views
Last Modified: 2012-05-11
Background: I have an ASP.Net web forms site that allows our web admins to create users. The new users are added to my domain (Active Directory - Users). I use Forms authentication and the ActiveDirectoryMembershipProvider (LDAP connection to my domain). When the user is being created I validate the password/confirm password through a RegEx to check for complexity and length. We require length 7, and Upper Case,Lower Case and Numeric or Special Character (fairly standard) and I also do some basic checks to verify the password doesn't include the username. My default domain policy password settings require the same length and I've set it to enforce complex passwords among other settings like account lock out duration etc... again fairly standard on a domain.

My Issue:
I'd like to be able to remove all my password validation code that I created and use the Default Domain Policy object in C#. This way if I change my default domain policy (i.e. change password length to 10 instead of 7) I won't have to update my RegEx to check for length of 10. My customer is not a big fan of hard-coded values like this and I most likely won't pass their code review, plus it would require an install to new version for a simple change like password length. It's been suggested to me to put the RegEx in my web.config like an app setting so any update would just be to the web.config. But then i won't have access to other properties like account settings.

Has anyone had success reading the Default Domain Policy in C# or are there API's or classes I can reference to access these types of objects? I've done some googling but i'm not having much luck. Any pointers would be great. Also, if this is just not possible please let me know so I can stop banging my head on my desk.


Tech:
I'm using VS2008, Framework 3.5.

My domain controller is running Windows 2008 Server R2, service pack 2.

0
Comment
Question by:farpoint1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 33

Accepted Solution

by:
it_saige earned 500 total points
ID: 34944839
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question