Les Snippets

Connexion

Récupère un SecurityIdentifier à partir d'un nom de compte

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 29/09/2009 13:55:30 et initié par Willi [Liste]
Vue : 1372
Catégorie(s) : Sécurité
Langages dispo pour ce code :
- C# 2.x, C# 3.x
- VB 2005, VB 2008



Langage : C# 2.x , C# 3.x
Date ajout : 29/09/2009
Posté par Willi [Liste]

/// <summary>
/// Obtient un objet <see cref="SecurityIdentifier"/> à partir d'un nom de compte.
/// </summary>
/// <param name="AccountName">Nom de compte.</param>
/// <returns></returns>
public static SecurityIdentifier GetSidFromAccountName(string AccountName)
{
    NTAccount na = new NTAccount(AccountName);
    return (SecurityIdentifier)na.Translate(typeof(SecurityIdentifier));
}

Langage : VB 2005 , VB 2008
Date ajout : 12/10/2009
Posté par Willi [Liste]
Public Shared Function GetSidFromAccountName(ByVal AccountName As String) As SecurityIdentifier 
  Dim na As New NTAccount(AccountName) 
  Return DirectCast(na.Translate(GetType(SecurityIdentifier)), SecurityIdentifier) 
End Function


Snippets en rapport avec : Name, Sid, Account, Securityidentifier



Codes sources en rapport avec : Name, Sid, Account, Securityidentifier

{IRC} ANTIBAN
hello, voici encore un antiban :p celui ci enleve les bans sur le nick, le host, le domain, les ba...

{C# / C#.NET} [.NET2] OBTENIR LES PROCESSUS ACTIFS DE TOUS LES COMPTES
Par l'intermédiaire d'un service Windows je devais surveiller toute les x secondes si un processus t...

{Visual Basic, VB6, VB.NET, VB 2005} TROUVER SID ET AUTRES INFOS UTILISATEUR GRÂCE À WMI
Tout est dans le titre... La source n'est pas de moi, merci MSDN. Je ne trouvais pas de moyen simp...

{C# / C#.NET} RÉCUPÉRATION SID UTILISATEUR À PARTIR DE SON NOM
Mon problème est de supprimer tous les documents récents de tous les utilisateurs. Pour l'utilisate...