Authenication and member of group

Ok, I've seen alot of authenication with asp.net. I have a couple of things I want to try that will not, or may not have access to a web.net.

1). I want to authenicate with a windows desktop app a user with the AD in a domain enviorment. Then, once I've authenicated this user, check to see if they are a member of an OU. How do I do this

Reason, I only want users that are part of a group to be able to modify data.

2). I want to see if a "local User" is part of a group. Then if user is in this group I want to be able to send a message to them saying they will be logged off soon.

Reason, If I log onto my home xp node, I can stay on as long as I want. If one of my kids log onto the computer, I want to log them off... say after 30 minutes..

Thanks for any suggestions... as long as the sugguests where helpful....LOL



Answer this question

Authenication and member of group

  • Erin

    Hi,

    You may take a look at the link below.
    The DirectorySearcher code will work for Winform too.
    Active Directory and LDAP
    http://www.codeproject.com/csharp/activedirusers.asp

    For local group, you may try to use the .NET buildin IsInRole method.
    e.g.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    MsgBox(My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator))
    End Sub

    If you still have any concern, please feel free to post here.

    Best regards,
    Peter Huang



  • Authenication and member of group