Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3932376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:27:06+00:00 2026-05-19T23:27:06+00:00

In my .NET 2.0 C# applcation I need to determine if a user (with

  • 0

In my .NET 2.0 C# applcation I need to determine if a user (with password) has ability to modify (write) option in Active Directory. I hope there is a way using DirectoryEntry without creating and then deleting new object in AD.

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:27:07+00:00Added an answer on May 19, 2026 at 11:27 pm

    Like Olive said, it’s difficult to do it right yourself. It’s difficult to do right because the permissions can be passed onto your user account via Active Directory groups. So, in order to find out the effective permission for a particular user account, you have to find out all the groups the user belongs to.

    Fortunately, Active Directory has a special type of attributes called constructed attributes. By default, if you are using AD Explorer or ADSI Edit to browse your object’s, these kinds of attributes are not shown. In ADSI Edit, you can set the Filter to include these constructed attributes. One of the useful constructed attributes here is allowedAttributesEffective. It’s a multi-value attribute and it contains all attributes that your current user has permission to write to. It’s calculated by Active Directory on the fly. It takes care all the inheritance, deny override and group permissions. If you have permission to write to cn attribute, you will see cn as one of the values in it.

    Here is a sample for checking a particular user has write permissions on a particular sets of attributes on a specific object on Active Directory.

    static bool CheckWritePermission(string path, string username, string password, string[] properties)
    {
        using (DirectoryEntry de = new DirectoryEntry(path, username, password))
        {
            de.RefreshCache(new string[] {"allowedAttributesEffective"});
            return properties.All( property => de.Properties["allowedAttributesEffective"].Contains(property));
        }
    }
    

    Yes, it’s not exactly what you want. You are asking to check if a user has WriteAllProperties permission. Actually, WriteAllProperties permission is a collection of write property permissions on different attributes. You may need to do some homework to find out what attributes your application really cares. Then, just pass in those attributes.

    If you really have no idea what attributes to check, this one should be good enough

    static bool CheckWritePermission(string path, string username, string password)
    {
        using (DirectoryEntry de = new DirectoryEntry(path, username, password))
        {
            de.RefreshCache(new string[] { "allowedAttributesEffective" });
            return de.Properties["allowedAttributesEffective"].Value != null;
        }            
    }
    

    Here, I am checking if the returned allowedAttributesEffective is null or not. If null, it means it doesn’t have any permissions to write to any attributes. I am assuming your administrator would either grant all write properties permission or deny all write properties. I think this is a valid assumption in most cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to determine the clients .NET framework version in my web application. I'm
I need to write a simple C# .NET application to retrieve, update, and insert
I need to re-write a businesss InfoPath / SharePoint application that has a fair
What is the best way to determine user logout on IIS server in C#/Asp.Net?
I am working on an ASP.NET WebForms project, and we need the ability to
In my asp.net application i need to integrate a jquery content slider with next,
In my ASP.net MVC application i need to get the host of the application
i developed a very simple vb.net application and i need a way for every
In the ASP.Net application I am writing I need to be able to have
I need to make a .net application where I must detect a specific object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.