Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   ntaccaunt.translate and AD (http://www.velocityreviews.com/forums/t769899-ntaccaunt-translate-and-ad.html)

Darko Bazulj 07-09-2008 12:33 AM

ntaccaunt.translate and AD
 
Hi,

problem:

when I create user or group I want to set permissions on OU for that user or
group.
But I'm getting error if I don't put some sleep 20-30 sec.

Like user or group doesn't exist and I can't do translate.
Like there is some problem with replication of data and I need to bind to DC
on which I created user or group and do translate.
But I don't know how.

Can someone help or suggest something??

ERROR :

Some or all identity references could not be translated. -- at
System.Security.Principal.NTAccount.Translate(Iden tityReferenceCollection
sourceAccounts, Type targetType, Boolean forceSuccess) at
System.Security.Principal.NTAccount.Translate(Type targetType) at
serviceprovisioning.ActiveDirectory.NTaccountToSID (String strNTaccountName,
String strADDomain) in C:\Users\darko\Documents\Visual Studio
2008\Projects\serviceprovisioning\serviceprovision ing\functions\ActiveDirectory.vb:line
237


CODE :

Function NTaccountToSID(ByVal strNTaccountName As String, ByVal strADDomain
As String) As SecurityIdentifier

Dim identity As New NTAccount(strADDomain, strNTaccountName)

line 237 --> Dim SID As SecurityIdentifier =
DirectCast(identity.Translate(GetType(SecurityIden tifier)),
SecurityIdentifier)

Return SID

End Function



Darko Bazulj 07-09-2008 11:48 AM

Re: ntaccaunt.translate and AD
 
Hi,

problem solved.

Now I can bind to DC on which I created user/group and set permissions on OU
without errors.

Here is the code, maybe help someone.

Function GetADObjectSID(ByVal strObjectDNname As String)

Dim DirEntry As DirectoryServices.DirectoryEntry = New
DirectoryServices.DirectoryEntry(strObjectDNname)
Dim objSid() As Byte = CType(DirEntry.Properties("objectSid").Value,
Byte())
Dim SID As New System.Security.Principal.SecurityIdentifier(objSi d,
0)

Return SID

End Function



All times are GMT. The time now is 01:23 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57