English 中文(简体)
我怎样才能获得使用正名录的用户最低密码年龄?
原标题:How can I get minimum password age of user in active directory using asp.net?

How can I get minimum password age of user in active directory using asp.net?
Using directory services or AspNetActiveDirectoryMembershipProvider

<><>For Example>

from below line, I can get lastname of user. 
string lastName = objDirectoryEntry.Properties["sn"].Value;

Below is the list of user attributes.I could not find in my required attribute minimum password age
http://www.kouti.com/tables/userattributes.htm

Note:I am taking about using Asp.net

Edit Summary-----------------------
I get following error when I try to change user password using directory service or AspNetActiveDirectoryMembershipProvider (it is default membership provider)


The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements


User created and updated successfully(update field like firstname,lastname etc).I am using both directory services and AspNetActiveDirectoryMembershipProvider to create and update user,But problem is with when I try to change password

For example: I created user with password anc1236! that created successfully
and now update password to xyyz4562@ and got error

below is the code that I am using to change password
objMembershipUser.ChangePassword(oldPassword, newPassword)
I also try with using directory services directly and get same error

问题回答

我认为,你正在研究错误目标。

When working with user accounts in Active Directory, it is common to need to refer to domain-wide account policies. For example, policies such as the minimum and maximum password age and the minimum password length, as well as lockout policy, are determined at the domain level and apply to each user object in the domain. All of the values are stored directly in the domain root object (not in RootDSE, but in the object pointed to by the defaultNamingContext attribute in RootDSE) as a set of attributes such as maxPwdAge, minPwdLength, and lockoutThreshold. Additionally, the password complexity rules are encoded in an enumerated value in the pwdProperties attribute. These values tend to be quite static in most domains, so we would typically want to read these values only once per program execution. To make the policy values easy to consume, we show in Listing 10.7 a wrapper class for the domain account policies that converts all of the values into convenient .NET data types, such as TimeSpan. A special .NET enumeration type for the types of the password policy is also included. We won’t be able to include all of the class properties in the book, as that would take too much space, but we will have the full class available on the book’s web site. We will refer to this sample in future discussions when demonstrating how to determine an account’s lockout status and for finding accounts with expiring passwords. It is also worthy to note that any LargeInteger values in these policy attributes are stored as negative values. We chose to invert them back to positive values because it is easier to think about them in this way. Developers choosing to use these attributes should keep this in mind, as it will throw off calculations later if not accounted for.

Look at this page for examples





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签