473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Admin Prevlidges

What is the best way to determine what access prevlidges the current user
has from within my running application? I need to insure the user has
administrator prevlidges for one particular function.

Thanks,

Dennis
Nov 17 '05 #1
2 957
Hi Dennis,

This best was is to create a WindowsPrincipal object out of the current
WindowsIdentity object [example below].

Cheers,
Steve Goodyear
using System.Security.Principal;
....
private void Form1_Load(object sender, System.EventArgs e)
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal user = new WindowsPrincipal(identity);
MessageBox.Show(
user.IsInRole(WindowsBuiltInRole.Administrator).To String());
}
Nov 17 '05 #2
Steve,

Thanks a million! I thought it must be something fairly easy to do.

Dennis
"Steve Goodyear" <St***********@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
Hi Dennis,

This best was is to create a WindowsPrincipal object out of the current
WindowsIdentity object [example below].

Cheers,
Steve Goodyear
using System.Security.Principal;
...
private void Form1_Load(object sender, System.EventArgs e)
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal user = new WindowsPrincipal(identity);
MessageBox.Show(
user.IsInRole(WindowsBuiltInRole.Administrator).To String());
}

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Mateer | last post by:
Hi Why does the following code allow me to keep the same session when in the same sub domain (ie admin.localhost), yet not when I goto another related domain eg main.localhost? I would like...
5
by: D E | last post by:
When using my web application manager (http://localhost:8080/admin) I forgot my password. Is there an XML file i can look at to remember/obtain (possibly even set). Thanks
6
by: Kartic | last post by:
Hello, I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. The installer, when executed under my login, fails as it requires administrator rights to install (why they have it as a...
6
by: Chuck | last post by:
What's the difference between using "catalog node" and catalog admin node"? -- Chuck Remove "_nospam" to reply by email
1
by: Stephan Neuhaus | last post by:
Hi all. I'm having a problem that's driving me nuts. I am not familiar with Access, but I have read the FAQ, searched google, read the Access Security FAQ, and looked at the Access Web, to no...
9
by: Andy Sutorius | last post by:
Hi group, I am getting the "could not load type" error and I'm not sure how to debug. Obviously it's a namespace error but I don't see it. Below are code snippets. Yes, the files sit in a...
11
by: AnhTai | last post by:
Hi all, I've just installed MySQL 5.0 on my sun box (runing Solaris 10, install from blastwave). This is my first time with MySQL so I don't have any exp with it. I have some troubles as: -...
4
by: Dan Holmes | last post by:
I admit this not being C# specific but i don't know where else to start. My application needs an "administrator" user id. This would function just like the "administrator" user id in windows. ...
7
by: n00b | last post by:
I have a database in which Access is automatically generating a sequence of Admin tables. It is due to the ODBC error (which I haven't found yet) listed in the table. Access seems to generate...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.