Showing posts with label Active Directory. Show all posts
Showing posts with label Active Directory. Show all posts

Monday, July 24, 2017

How to enable single sign on for your application


The  first step for this is to Register your application with your Azure Active Directory tenant. There a good article  @ docs.microsoft.com which explains this. Please have a look here  https://docs.microsoft.com/en-us/azure/active-directory/active-directory-app-registration

Tuesday, November 29, 2016

Configuring an Executable to Run as a Service on Windows Server?


Windows NT Resource Kit provides below two utilities that allow you to run an executable as a service

Instrsrv.exe
Srvany.exe
 

More details regarding the same can be found at the below links.


Monday, December 9, 2013

C# Code to read Active directory attributes for a user

Juts add the below code to a Windows/Web solution and assign the results to a label in you form

using System.DirectoryServices;
using System.Collections;

DirectoryEntry dir = new DirectoryEntry();
dir.Path = "LDAP://YourActiveDirServername ";
DirectorySearcher sea = new DirectorySearcher(dir);
sea.Filter = "(sAMAccountName=user)";
SearchResult seares = sea.FindOne();
StringBuilder str = new StringBuilder();
System.DirectoryServices.ResultPropertyCollection prop = seares.Properties;
ICollection coll = prop.PropertyNames;
IEnumerator enu = coll.GetEnumerator();
while (enu.MoveNext())
{
str.Append(enu.Current + " = " + seares.Properties[enu.Current.ToString()][0] + "\n");
}

label1.Text = str.ToString();