Click here to Skip to main content
15,885,638 members
Home / Discussions / C#
   

C#

 
QuestionHow to put two columns in a combo box Pin
Member 1227854217-Nov-17 0:20
Member 1227854217-Nov-17 0:20 
AnswerRe: How to put two columns in a combo box Pin
Eddy Vluggen17-Nov-17 0:46
professionalEddy Vluggen17-Nov-17 0:46 
GeneralRe: How to put two columns in a combo box Pin
Member 1227854220-Feb-18 1:17
Member 1227854220-Feb-18 1:17 
AnswerRe: How to put two columns in a combo box Pin
Karthik_Mahalingam17-Nov-17 0:59
professionalKarthik_Mahalingam17-Nov-17 0:59 
GeneralRe: How to put two columns in a combo box Pin
Member 1227854220-Feb-18 1:09
Member 1227854220-Feb-18 1:09 
GeneralRe: How to put two columns in a combo box Pin
Karthik_Mahalingam20-Feb-18 1:11
professionalKarthik_Mahalingam20-Feb-18 1:11 
QuestionActive Directory Questions Pin
Kevin Marois16-Nov-17 7:58
professionalKevin Marois16-Nov-17 7:58 
AnswerRe: Active Directory Questions Pin
Richard Deeming16-Nov-17 9:50
mveRichard Deeming16-Nov-17 9:50 
It will probably be easier to use the System.DirectoryServices.AccountManagement[^] namespace. You can use Active Directory groups to represent the roles.
C#
public static bool ValidateCredentials(string userName, string password)
{
    using (var context = new PrincipalContext(ContextType.Domain))
    {
        return context.ValidateCredentials(userName, password);
    }
}

public static bool IsUserActive(string userName)
{
    using (var context = new PrincipalContext(ContextType.Domain))
    {
        var user = UserPrincipal.FindByIdentity(context, userName);
        return user != null && user.Enabled == true;
    }
}

public static bool IsUserInRole(string userName, string roleName)
{
    using (var context = new PrincipalContext(ContextType.Domain))
    {
        var user = UserPrincipal.FindByIdentity(context, userName);
        var group = GroupPrincipal.FindByIdentity(context, roleName);
        return user != null && group != null && user.IsMemberOf(group);
    }
}


To detect whether the computer is joined to a domain, you'll need to P/Invoke the NetGetJoinInformation[^] function:
.net - How to detect if machine is joined to domain (in C#)? - Stack Overflow[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Active Directory Questions Pin
Kevin Marois16-Nov-17 10:01
professionalKevin Marois16-Nov-17 10:01 
GeneralRe: Active Directory Questions Pin
Kevin Marois16-Nov-17 10:49
professionalKevin Marois16-Nov-17 10:49 
GeneralRe: Active Directory Questions Pin
Mycroft Holmes16-Nov-17 11:36
professionalMycroft Holmes16-Nov-17 11:36 
AnswerRe: Active Directory Questions Pin
BillWoodruff16-Nov-17 20:44
professionalBillWoodruff16-Nov-17 20:44 
GeneralRe: Active Directory Questions Pin
Richard MacCutchan16-Nov-17 22:54
mveRichard MacCutchan16-Nov-17 22:54 
GeneralRe: Active Directory Questions Pin
Kevin Marois17-Nov-17 4:39
professionalKevin Marois17-Nov-17 4:39 
AnswerRe: Active Directory Questions Pin
Nathan Minier17-Nov-17 1:36
professionalNathan Minier17-Nov-17 1:36 
Generalsession Pin
Ishi Kaushik16-Nov-17 7:04
Ishi Kaushik16-Nov-17 7:04 
AnswerRe: Hello , I am working on three tier architecture based project, i am stuck in writting session code. so please tell me how and where i can write the session code Pin
OriginalGriff16-Nov-17 8:03
mveOriginalGriff16-Nov-17 8:03 
QuestionData type mismatch in criteria expression." in c# Pin
sai.201216-Nov-17 5:54
sai.201216-Nov-17 5:54 
AnswerRe: Data type mismatch in criteria expression." in c# Pin
Gerry Schmitz16-Nov-17 6:35
mveGerry Schmitz16-Nov-17 6:35 
AnswerRe: Data type mismatch in criteria expression." in c# Pin
Eddy Vluggen16-Nov-17 7:07
professionalEddy Vluggen16-Nov-17 7:07 
PraiseRe: Data type mismatch in criteria expression." in c# Pin
sai.201216-Nov-17 9:56
sai.201216-Nov-17 9:56 
GeneralRe: Data type mismatch in criteria expression." in c# Pin
Eddy Vluggen16-Nov-17 10:33
professionalEddy Vluggen16-Nov-17 10:33 
QuestionLicensing a .NET DLL Pin
P.Gnanaraj16-Nov-17 2:17
P.Gnanaraj16-Nov-17 2:17 
AnswerRe: Licensing a .NET DLL Pin
Richard MacCutchan16-Nov-17 3:20
mveRichard MacCutchan16-Nov-17 3:20 
QuestionAsync method/task issue Pin
primem0ver15-Nov-17 7:21
primem0ver15-Nov-17 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.