By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Is user an administrator

P: n/a
Is there an easy way to tell if the current user is an administrator?

Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.