or use windows provider: this is the vb code,
could you help to convert it to c# code?
Const ADS_UF_PASSWD_CANT_CHANGE = &H40
Function UserCannotChangePassword(strDomain As String, strUser As String, strUserCred As String, strPassword As String) As Boolean
UserCannotChangePassword = False
Dim oUser As IADs
strPath = "WinNT://" + strDomain + "/" + strUser
If "" <> strUserCred Then
Dim dso As IADsOpenDSObject
' Bind to the group with the specified user name and password.
Set dso = GetObject("WinNT:")
Set oUser = dso.OpenDSObject(strPath, strUserCred, strPassword, 1)
Else
' Bind to the group with the current credentials.
Set oUser = GetObject(strPath)
End If
If (oUser.Get("userFlags") And ADS_UF_PASSWD_CANT_CHANGE) <> 0 Then
UserCannotChangePassword = True
Else
UserCannotChangePassword = False
End If
End Function