Click here to Skip to main content
6,306,412 members and growing! (19,111 online)
Email Password   helpLost your password?
Languages » C# » Applications     Intermediate

Logon Account Permissions Checker

By Vasudevan Deepak Kumar

This is a simple class/demo application that shows how to check whether the account that is being used to run the application has administrative rights.
C#.NET 1.0, Win2K, WinXP, Visual Studio, Dev
Posted:24 Nov 2002
Views:55,983
Bookmarked:36 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
7 votes for this article.
Popularity: 1.11 Rating: 1.31 out of 5
5 votes, 83.3%
1

2

3
1 vote, 16.7%
4

5

Introduction

Many a times, when we write a simple application that accesses some system resources and if Local Security Policy needs administrative rights to run the application, then our application would just crash. For simple testing purposes too, using a MSI installer would be an involved process. Perhaps a small class to automatically check for administrative privileges of the logged on account or the account that is being used to run the application (using the RunAs utility) would be really helpful in these circumstances.

Solution

In .NET, investigating the account's principal, logged on name etc. is just a breeze. System.Security namespace has dozens of utilities and classes that really helps in getting the thing done like in the current context, checking whether the account has administrative rights etc.

Additions

The class that checks the account roles has been kept separate in the accompanying demo file from the application, since we can in the future add facilities like checking for roles, permissions and more granular level operations can be incorporated over there.

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

Vasudevan Deepak Kumar


Member
Vasudevan Deepak Kumar is from Chennai, India who has been in the programming career since 1994, when he was 15 years old. He has his Bachelors of Engineering (in Computer Science and Engineering) from Vellore Engineering College (now VIT University). He also has a MBA in Systems from Alagappa University, Karaikudi, India.


He started his programming career with GWBasic and then in his college was involved in developing programs in Fortran, Cobol, C++. He has been developing in Microsoft technologies like ASP, SQLServer 2000. For sometime, he has also been with PHP and MySQL based development in one of his previous organizations. Now currently his focus is on Microsoft .NET World (ASP.NET, C# and Whidbey)


In his past-time, he listens to polite Carnatic Music.

Web Presence



Homepage

http://www.lavanyadeepak.tk/

Blogs



Technical




Gossips




Spiritual







Occupation: Web Developer
Location: India India

Other popular C# articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 4 of 4 (Total in Forum: 4) (Refresh)FirstPrevNext
GeneralNice Demo PinmemberGevik Babakhani14:10 25 Nov '02  
GeneralWhy not? PinmemberMatthew Adams5:28 25 Nov '02  
GeneralRe: Why not? PinmemberDeepak Kumar Vasudevan5:33 25 Nov '02  
GeneralRe: Why not? PinmemberMatthew Adams6:03 25 Nov '02  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 24 Nov 2002
Editor: Smitha Vijayan
Copyright 2002 by Vasudevan Deepak Kumar
Everything else Copyright © CodeProject, 1999-2009
Web12 | Advertise on the Code Project