hi,
how can i Check if user logged on as admin? in windows App. (VB)
notice: i used the login Form
Regards,
Want to boost your .NET application performance?
Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.
Try it for yourself now.
Private Function IsAdmin() As Boolean Dim principal As WindowsPrincipal = New WindowsPrincipal(WindowsIdentity.GetCurrent()) If principal.IsInRole(WindowsBuiltInRole.Administrator) Then Return True Else Return False End If End Function
thank you for your help
but
how can i use this function , where should i call it ?
Wherever you need it, for exampleIf IsAdmin thenMessageBox.Show("User identified as Admin, logging in")'do stuff else MessageBox.Show("You need Administrator privileges to log in")'quit or whateverend if