I'm having a curious problem when using Windows authentication with a web
service. I can successfully retrieve the correct user name. I can also use
code like the following to test if the user in an administrator:

Dim Principal As WindowsPrincipal
Principal = CType(User, WindowsPrincipal)
Return Principal.IsInRole(WindowsBuiltInRole.Administrator)

However, if I use the overloaded IsInRole() method that requires the
string name of the group, it always returns false. For example, neither of
these code statements give me the right answer:

Return Principal.IsInRole("Administrators")

Return Principal.IsInRole("MYCOMPUTER\Administrators")

(Where MYCOMPUTER is the name of my local machine.) Has anyone else
discovered this discrepancy?

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to