473,387 Members | 1,606 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,387 software developers and data experts.

Is user an administrator

Is there an easy way to tell if the current user is an administrator?

Thanks
Nov 21 '05 #1
5 1672

"Jack Russell"
Is there an easy way to tell if the current user is an administrator?

http://msdn.microsoft.com/library/de...nroletopic.asp

I hope this helps,

Cor
Nov 21 '05 #2
Cor Ligthert wrote:
"Jack Russell"
Is there an easy way to tell if the current user is an administrator?


http://msdn.microsoft.com/library/de...nroletopic.asp

I hope this helps,

Cor

thanks, I think it does but life would be much easier if someone at MS
spoke English!
Nov 21 '05 #3
well maybe this is an easier to understand example :-)
Dim ident As System.Security.Principal.WindowsIdentity =
System.Security.Principal.WindowsIdentity.GetCurre nt()

Dim user As New System.Security.Principal.WindowsPrincipal(ident)

If Not (user.IsInRole(Security.Principal.WindowsBuiltInRo le.Administrator))
Then

Me.Visible = False

MsgBox("Settings form only availlable for Administrators ! ",
MsgBoxStyle.DefaultButton3)

Me.Close()

End If


Michel Posseth [MCP]
"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Cor Ligthert wrote:
"Jack Russell"
Is there an easy way to tell if the current user is an administrator?


http://msdn.microsoft.com/library/de...nroletopic.asp

I hope this helps,

Cor

thanks, I think it does but life would be much easier if someone at MS
spoke English!

Nov 21 '05 #4
"Jack Russell" <ja***@norubbish.tpg.com.au> schrieb:
Is there an easy way to tell if the current user is an administrator?


\\\
Imports System.Security.Principal
..
..
..
Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
Dim IsAdmin As Boolean = wp.IsInRole(WindowsBuiltInRole.Administrator)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #5
m.posseth wrote:
well maybe this is an easier to understand example :-)
Dim ident As System.Security.Principal.WindowsIdentity =
System.Security.Principal.WindowsIdentity.GetCurre nt()

Dim user As New System.Security.Principal.WindowsPrincipal(ident)

If Not (user.IsInRole(Security.Principal.WindowsBuiltInRo le.Administrator))
Then

Me.Visible = False

MsgBox("Settings form only availlable for Administrators ! ",
MsgBoxStyle.DefaultButton3)

Me.Close()

End If


Michel Posseth [MCP]
"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Cor Ligthert wrote:
"Jack Russell"
Is there an easy way to tell if the current user is an administrator?
http://msdn.microsoft.com/library/de...nroletopic.asp

I hope this helps,

Cor


thanks, I think it does but life would be much easier if someone at MS
spoke English!


Thanks, i wish I had that before I tried to interpret Ms jumble!
Nov 21 '05 #6

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

Similar topics

1
by: Thomas Xu | last post by:
Hi guys, I'm trying to install DB2 v8.1 personal edition on WinXP, but keep getting complaint from installation program about invalid authority to perform the installation. I have Administrator...
11
by: Yasaswi Pulavarti | last post by:
I know there are some sample user exit programs in sqllib/samples/c directory. How do I tell DB2, which user exit program to use? I know I have to edit and compile the c based user exit programs,...
3
by: MLH | last post by:
I was running the following code while logged in as a user belonging only to the Users group. Set usrNew = .CreateUser(Me!UserID) 'The user ID is in a control on the form usrNew.PID =...
4
by: Feldman Alex | last post by:
Hi all, I need to know the user privileges (does user have administrator privileges) .. Which c# api's should i use? Thanks a lot
2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
5
by: Victor Jones | last post by:
I had a question about accessing HttpContext.User in global.asax. I was trying to access HttpContext.User in Application_BeginRequest() which had a null value as opposed to containing a valid...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
1
by: abhu50 | last post by:
HIIIIIIIIIIIII TO ALL OD YOU, I had been added some server role like application serve,dns server,dhcp server,domain controller ,active directory but after sometime i removed everything from...
31
by: zdenko | last post by:
I have a multi user database and users were created by user level security wizzard - as I mentioned in message before. Everything works fine for those users, but now I have another problem. I have...
2
by: Scott | last post by:
Attempting to install WCF service on stand alone 2003 server as a admin user (not administrator but user "WCF" i.e user added to local admin group). It fails with user error: The description...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.