Convert byte[] or object to GUID
How about using the Guid constructor which takes a byte array? Guid guid = new Guid(binaryData); (You can then use Guid.ToString() to get it in text form if you need to.)
How about using the Guid constructor which takes a byte array? Guid guid = new Guid(binaryData); (You can then use Guid.ToString() to get it in text form if you need to.)
Yes it’s possible using a claim based authentication. It’s integrated to .Net 4.5 now (before it was called WIF). You can use Thinktucture, which is a very robust authentication provider it has a full example on how to integrate ADFS. Here is a link for it. Here is another way to do it for an … Read more
Disclaimer: This code doesn’t search for a single exact match, so for domain\j_doe it may return domain\j_doe_from_external_department‘s email address if such similarly named account also exists. If such behaviour is undesirable, then either use a samAccountName filter intead of an anr one used below or filter the results additionally. I have used this code successfully … Read more
You want the win32security module, which is a part of pywin32. Here’s an example of doing the sort of thing you want to do. That example creates a new DACL for the file and replaces the old one, but it’s easy to modify the existing one; all you need to do is get the existing … Read more
Assuming you have created a user in this database associated with the AD login, e.g. CREATE LOGIN [domain\user] FROM WINDOWS; GO USE your_database; GO CREATE USER [domain\user] FROM LOGIN [domain\user]; GO Then you merely have to follow the same syntax. Because \ is not a standard character for an identifier, you need to escape the … Read more
DateTime.FromFileTime should do the trick: PS C:\> [datetime]::FromFileTime(129948127853609000) Monday, October 15, 2012 3:13:05 PM Then depending on how you want to format it, check out standard and custom datetime format strings. PS C:\> [datetime]::FromFileTime(129948127853609000).ToString(‘d MMMM’) 15 October PS C:\> [datetime]::FromFileTime(129948127853609000).ToString(‘g’) 10/15/2012 3:13 PM If you want to integrate this into your one-liner, change your select … Read more
Here’s another more recent snippet (July 2008, updated Dec 2015): Authentication Against Active Directory (LDAP) over SSL
Here is a simple code that authenticate and make an LDAP search usin JNDI on a W2K3 : class TestAD { static DirContext ldapContext; public static void main (String[] args) throws NamingException { try { System.out.println(“Début du test Active Directory”); Hashtable<String, String> ldapEnv = new Hashtable<String, String>(11); ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory”); //ldapEnv.put(Context.PROVIDER_URL, “ldap://societe.fr:389”); ldapEnv.put(Context.PROVIDER_URL, “ldap://dom.fr:389”); ldapEnv.put(Context.SECURITY_AUTHENTICATION, “simple”); … Read more