ADO DOT NET
Centurion
- Joined
- Dec 20, 2006
- Messages
- 160
Hi,
I want to check if my user is admin or not?
IF not, give him a nice error and End my application!
I only need to run this in Windows XP, Vista and Server 2003 !
I have these 2 codes:
I just wanna know which one is correct and better to use for me?
What's the different between these two?
Thank you.
I want to check if my user is admin or not?
IF not, give him a nice error and End my application!
I only need to run this in Windows XP, Vista and Server 2003 !
I have these 2 codes:
Visual Basic:
CODE 1:
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
End
End If
Visual Basic:
CODE 2:
Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
If wp.IsInRole(WindowsBuiltInRole.Administrator) = False Then
End
End If
What's the different between these two?
Thank you.