Click here to Skip to main content
12,295,791 members (47,599 online)
Click here to Skip to main content


125 bookmarked

The Windows Access Control Model Part 3

, 1 Jul 2005
In the third part of this series, we will take a tour of the new access control classes coming in .NET v2.0.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Principal;

namespace NetAccessControl
    public partial class ViewSids : Form
        public ViewSids()

        private void chkSidsBtn_Click(object sender, EventArgs e)
                /* disable this button */
                if (this.nameEdit.Text == "")
                    /* Convert the SID */
                    SecurityIdentifier Sid = new SecurityIdentifier(this.sidEdit.Text);
                    /* Interestingly, SDDL aliases work here. */
                    NTAccount Account = (NTAccount)Sid.Translate(typeof(NTAccount));
                    this.nameEdit.Text = Account.Value;
                    /* Use the Username text box */
                    NTAccount Account = new NTAccount(this.nameEdit.Text);
                    SecurityIdentifier Sid = (SecurityIdentifier)Account.Translate(typeof(SecurityIdentifier));
                    this.sidEdit.Text = Sid.Value;
            catch (System.Exception ex)
                this.sidEdit.Text = "Error occurred: " + ex.Message;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


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

Web Developer
United States United States
Mr. Shah is a reclusive C++/C# developer lurking somewhere in the depths of the city of London. He learnt physics at Kings' College London and obtained a Master in Science there. Having earned an MCAD, he teeters on the brink of transitioning from C++ to C#, unsure of which language to jump to. Fortunately, he also knows how to use .NET interop to merge code between the two languages (which means he won't have to make the choice anytime soon).

His interests (apart from programming) are walking, football (the real one!), philosophy, history, retro-gaming, strategy gaming, and any good game in general.

He maintains a website / blog / FAQ / junk at, where he places the best answers he's written to the questions you've asked. If you can find him, maybe you can hire Mr. Shah to help you with anything C++[/CLI]/C#/.NET related Smile | :) .

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 1 Jul 2005
Article Copyright 2005 by oshah
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid