Click here to Skip to main content
Click here to Skip to main content

Updating Windows Security Groups using VB.NET and Directory Services

By , 22 Dec 2004
 

Introduction

Do you use Integrated Windows Security to manage permissions in your applications and or databases? The class AD_Group.vb provided in this sample project will let you easily Add, Remove and List users in a Windows group. My development group uses group security in our ASP.NET applications using the User.IsInRole ("Domain\Group") function all the time. We also set permissions to our web directories at the group level. Now we manage our groups easily with VB.NET code. It's a lot quicker than logging on to our DC server and using the Active Directory GUI provided in Windows Server 2000. The Windows application pictured below is one way I put the AD_Group.vb class to good use.

To use this code, add a reference to the DirectoryServices.dll:

After your reference has been added, simply Add Existing Item to your project. Add the AD_Group.vb file contained in this sample project like so:

Then you can call the code like this:

Dim Obj AsNew AD_Group(MyDomain, MyServer, MyGroup)
Obj.RemoveUser("UserName")

That's basically it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

spidur1
Web Developer
United States United States
Member
Todd is currently working at PA Lumbermens as a .net programmer.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalwindows authenticationmemberBMWABCD18 Jan '07 - 11:07 
Hi,
 
My web application uses windows authentication. I wonder why the domain user neither the AdminG or UserG group can still access the aspx page?
 
The following is my code in web.config.
 








 
thanks.
 
Thanks.

Questionfinding Domain Name, Server Name & Group NamememberJwalant Natvarlal Soneji21 Dec '05 - 18:56 
the code is fine, but i dont get the Domain name, Domain Controller name & Group Name,
in the code the domain controller name is also described as server name
 
my pc is in a cojusted network
plz give me the way to find out the correct things,
 
thanks,
 
Jwalant Soneji (BE IT)
jnsoneji@hotmail.com

Generalaccess deniedmemberfirstmaster27 Oct '05 - 15:56 
D'Oh! | :doh: i've got message "access denied"
GeneralRe: access deniedmemberToddHileHoffer29 Oct '05 - 14:35 
You need to have admin rights.
 
"People who never make mistakes, never do anything."
My Blog
GeneralSecuritymemberPradeep Panzade20 Feb '05 - 18:04 
How to give security i.e permissions to specific folder for specific user using .net classes.
 
pradeepvpanzade@aesics.ac.in

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 22 Dec 2004
Article Copyright 2004 by spidur1
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid