How to authenticate against the Active Directory by using Forms authentication and Visual C# .NET RRS feed

  • Question

  • User-25721236 posted

    Hi All,

    I read about and I followed a link I found here.


    I have it working correctly (I think) because it will say

    Hello JohnDoe.
    You were authenticated using LdapAuthentication.

    but I want to only let certain AD group member ships (TimeCallAppUsers) into the application.  I read on the support page that the code does call the LdapAuthentication.GetGroups method but I don't know how to tell it to authenticate and allow only those in the group TimeCallAppUsers.

    Can anyone please, please, please help me?

    Thursday, September 29, 2011 2:47 PM


  • User1560780540 posted

    As per the mentioned article, following line will give you all the groups (in groups string variable )the current user is member of. just check if your group name(TimeCallAppUsers) is there in the string. If it is not there in the string, user is not member of that group and you can return false otherwise proceed with rest of the method call (i.e. creating ookie and all the stuff)


    if(true == adAuth.IsAuthenticated(txtDomain.Text, txtUsername.Text, txtPassword.Text))
          String groups = adAuth.GetGroups();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 30, 2011 12:34 AM