Connecting Tech Pros Worldwide Forums | Help | Site Map

IsInRole always false

JIM.H.
Guest
 
Posts: n/a
#1: Nov 18 '05
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.


Dale
Guest
 
Posts: n/a
#2: Nov 18 '05

re: IsInRole always false


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." <JIMH@discussions.microsoft.com> wrote in message
news:B25B7615-D84F-4D50-9A06-4CB72586FF07@microsoft.com...[color=blue]
> Hello,
> username=user.identity.name
> trueFalse=User.IsInRole("myDomain\Administrators") ?
> First line return user name as administrator but second line returns[/color]
false? What might be the reason? Or how does isInRole work?[color=blue]
> Thanks,
> Jim.
>[/color]


caldera
Guest
 
Posts: n/a
#3: Nov 18 '05

re: IsInRole always false


insert <identity impersonate="true" /> in webconfig


John Saunders
Guest
 
Posts: n/a
#4: Nov 18 '05

re: IsInRole always false


"JIM.H." <JIMH@discussions.microsoft.com> wrote in message
news:B25B7615-D84F-4D50-9A06-4CB72586FF07@microsoft.com...[color=blue]
> Hello,
> username=user.identity.name
> trueFalse=User.IsInRole("myDomain\Administrators") ?
> First line return user name as administrator but second line returns[/color]
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").
--
John Saunders
johnwsaundersiii at hotmail


Dale
Guest
 
Posts: n/a
#5: Nov 18 '05

re: IsInRole always false


Duh.... Good eye!
"John Saunders" <johnwsaundersiii@notcoldmail.com> wrote in message
news:OEs6IekcEHA.2504@TK2MSFTNGP12.phx.gbl...[color=blue]
> "JIM.H." <JIMH@discussions.microsoft.com> wrote in message
> news:B25B7615-D84F-4D50-9A06-4CB72586FF07@microsoft.com...[color=green]
> > Hello,
> > username=user.identity.name
> > trueFalse=User.IsInRole("myDomain\Administrators") ?
> > First line return user name as administrator but second line returns[/color]
> 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").
> --
> John Saunders
> johnwsaundersiii at hotmail
>
>[/color]


John Saunders
Guest
 
Posts: n/a
#6: Nov 18 '05

re: IsInRole always false


"JIM.H." <JIMH@discussions.microsoft.com> wrote in message
news:C3815887-ADBB-4BF3-8890-8246D6742CC3@microsoft.com...[color=blue]
> Hi Dale,
> User.Identity.Name returns "myDomain\myUseranme"
> but both User.IsInRole("MyDomain\Administrator") and[/color]
User.IsInRole("BUILTIN\Administrator") returns false[color=blue]
> any Idea?[/color]

Did you try doubling the "\"?
--
John Saunders
johnwsaundersiii at hotmail

[color=blue]
> "Dale" wrote:
>[color=green]
> > 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." <JIMH@discussions.microsoft.com> wrote in message
> > news:B25B7615-D84F-4D50-9A06-4CB72586FF07@microsoft.com...[color=darkred]
> > > Hello,
> > > username=user.identity.name
> > > trueFalse=User.IsInRole("myDomain\Administrators") ?
> > > First line return user name as administrator but second line returns[/color]
> > false? What might be the reason? Or how does isInRole work?[color=darkred]
> > > Thanks,
> > > Jim.
> > >[/color]
> >
> >
> >[/color][/color]


John Saunders
Guest
 
Posts: n/a
#7: Nov 18 '05

re: IsInRole always false


"John Saunders" <johnwsaundersiii@notcoldmail.com> wrote in message
news:eWz490$cEHA.2384@TK2MSFTNGP09.phx.gbl...[color=blue]
> "JIM.H." <JIMH@discussions.microsoft.com> wrote in message
> news:C3815887-ADBB-4BF3-8890-8246D6742CC3@microsoft.com...[color=green]
> > Hi Dale,
> > User.Identity.Name returns "myDomain\myUseranme"
> > but both User.IsInRole("MyDomain\Administrator") and[/color]
> User.IsInRole("BUILTIN\Administrator") returns false[color=green]
> > any Idea?[/color]
>
> Did you try doubling the "\"?[/color]

Sorry, didn't notice you were using VB.NET until after I posted this.
--
John Saunders
johnwsaundersiii at hotmail


Closed Thread