IsInRole always false

G

Guest

Hello,
username=user.identity.name
trueFalse=User.IsInRole("myDomain\Administrators")?
First line return user name as administrator but second line returns false? What might be the reason? Or how does isInRole work?
Thanks,
Jim.
 
D

Dale

Is username returning a local machine administrator rather than domain
administrator? Since you didn't specify that username is
myDomain\Administrator, it isn't clear. If the user is a domain
administrator, it should work just like you have it.

Dale Preston
MCAD, MCSE, MCDBA


JIM.H. said:
Hello,
username=user.identity.name
trueFalse=User.IsInRole("myDomain\Administrators")?
First line return user name as administrator but second line returns
false? What might be the reason? Or how does isInRole work?
 
J

John Saunders

JIM.H. said:
Hello,
username=user.identity.name
trueFalse=User.IsInRole("myDomain\Administrators")?
First line return user name as administrator but second line returns
false? What might be the reason? Or how does isInRole work?

If you are programming in C#, then I think you need to escape the "\". Try
User.IsInRole("myDomain\\Administrators").
 
D

Dale

Duh.... Good eye!
John Saunders said:
false? What might be the reason? Or how does isInRole work?

If you are programming in C#, then I think you need to escape the "\". Try
User.IsInRole("myDomain\\Administrators").
 
J

John Saunders

John Saunders said:
User.IsInRole("BUILTIN\Administrator") returns false

Did you try doubling the "\"?

Sorry, didn't notice you were using VB.NET until after I posted this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top