Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,

There is interesting problem down here.
I use this code
If My.User.CurrentPrincipal.IsInRole("Administrators") Then
      MsgBox("Administrator")
    Else
      MsgBox("Not Administrator")
End If

in two different applications with below specs:
1. Windows Form Application with .NET Framework 3.5 (VB.NET)
2. WPF Windows Applciation with .NET Framework 3.5 (VB.NET)

In WinForm app it shows Administrator in Message Box. But, in WPF it shows Not Administrator.
What is reason behind this ? Any idea ?
Thanks,

Regards,
Itz.Irshad
Posted
Comments
Nelek 12-Apr-12 13:08pm    
Maybe you are getting the privilege of the programm execution ("run as...") instead of getting the privileges of the user. Can it be?
Itz.Irshad 13-Apr-12 0:53am    
Dear Nelek,

Both applications are running on Win XP. Is there possibility to get that issue ?
Thanks

Regards,
Itz.Irshad

1 solution

There is some other difference than this. The display technology used has no effect at all on the code you're posting.
 
Share this answer
 
Comments
Itz.Irshad 13-Apr-12 0:47am    
Dear Dave Kreskowiak,

I think so but, didn't able to figure out that. Any suggestion to figure out that ?
Thanks

Regards,
Itz.Irshad

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900