Ask a Question related to ASP.NET Web Services, Design and Development.
-
Oliver Rainer #1
User.IsInRole is always FALSE
Hi, I have the following problem...
Pre-requisites:
Installation of an Asp.net webservice on a IIS5 server (win2k). Anonymous
access is not allowed, only using windows authentication (intranet app),
webmethoda are using the Principalpermssion attribute
([PrincipalPermission(SecurityAction.Demand,
Role=@"DomainName\WindowsGroup...")]) for identification.
Result --> does not work
When I change the to [PrincipalPermission(SecurityAction.Demand,
name=@"DomainName\Windowsuser...")]) -> it runs fine
--> conclusion: IIS cannot determine if a user belongs to an AD group -->
IPrincipal.IsInRole(@"DomainName\WindowsGroup") is always FALSE!
I already found an article on the web
([url]http://www.kbalertz.com/kb_894432.aspx[/url] --> web dir is UNC share), but
didn't solved the problem...
Does anyone know more about this issue?
Thanks
Oliver Rainer
Oliver Rainer Guest
-
HttpContext.Current.User.IsInRole
Hi, I have a problem when I am using the HttpContext.Current.User.IsInRole... This is my code: if (HttpContext.Current.User.IsInRole("Admin... -
isInRole doesn't work for one user, but works for everyone else
I have an ASP.NET/C# application in which I verify that the current user is a member of a list of roles before giving them access to particular... -
HttpContext.Current.User.IsInRole(string) always returns false
I have a asp.net 1.1 site and HttpContext.Current.User.IsInRole(@"MyLocalComputer\MyGroup") always returns false. I've turned off anonymous... -
ASP.NET Context.User.IsInRole XP Problem
Hi guys I am having a problem with the following line of code on Windows XP Pro. The variable userRole is a string depicting my role on the local... -
User.IsInRole not redirecting
Hi there, I have been reading up on Authorization and role based security for a couple of days now, and am trying to implement this in my... -
Joseph Bittman MCAD #2
Re: User.IsInRole is always FALSE
June 7, 2005
hehe I actually have to go to a meeting right now, but a quick suggestion
before I leave. Try switching the PrincipalPermission
role="domain\groupname" to "BUILTIN\GROUPNAME". There is a little more to
this change, but it should work.... depending on which role it is, so if you
could post it, that would really help... until later! :-)
--
Joseph Bittman
Microsoft Certified Application Developer
Web Site: [url]http://71.35.110.42[/url]
Dynamic IP -- Check here for future changes
"Oliver Rainer" <olrainer@tiscali.ch> wrote in message
news:ubg7WH3aFHA.2440@TK2MSFTNGP10.phx.gbl...> Hi, I have the following problem...
>
> Pre-requisites:
> Installation of an Asp.net webservice on a IIS5 server (win2k). Anonymous
> access is not allowed, only using windows authentication (intranet app),
> webmethoda are using the Principalpermssion attribute
> ([PrincipalPermission(SecurityAction.Demand,
> Role=@"DomainName\WindowsGroup...")]) for identification.
>
> Result --> does not work
>
> When I change the to [PrincipalPermission(SecurityAction.Demand,
> name=@"DomainName\Windowsuser...")]) -> it runs fine
>
> --> conclusion: IIS cannot determine if a user belongs to an AD group -->
> IPrincipal.IsInRole(@"DomainName\WindowsGroup") is always FALSE!
>
> I already found an article on the web
> ([url]http://www.kbalertz.com/kb_894432.aspx[/url] --> web dir is UNC share), but
> didn't solved the problem...
>
> Does anyone know more about this issue?
>
> Thanks
> Oliver Rainer
>
>
>
Joseph Bittman MCAD Guest
-
Oliver Rainer #3
Re: User.IsInRole is always FALSE
Thanks for your suggestion... that really works for local groups (BUILTIN),
but IIS still has the problem to resolve AD groups (OURDOMAIN\...)... The
strange thing is that on certain machines (our developer machines), IIS can
succesfully determine if a user belongs to an AD group...
Do you have other suggestions??
Thanks
Oliver Rainer
"Joseph Bittman MCAD" <RyanBittman@msn.com> wrote in message
news:eIRT4F4aFHA.3280@TK2MSFTNGP12.phx.gbl...you> June 7, 2005
>
> hehe I actually have to go to a meeting right now, but a quick suggestion
> before I leave. Try switching the PrincipalPermission
> role="domain\groupname" to "BUILTIN\GROUPNAME". There is a little more to
> this change, but it should work.... depending on which role it is, so ifAnonymous> could post it, that would really help... until later! :-)
>
> --
> Joseph Bittman
> Microsoft Certified Application Developer
>
> Web Site: [url]http://71.35.110.42[/url]
> Dynamic IP -- Check here for future changes
>
> "Oliver Rainer" <olrainer@tiscali.ch> wrote in message
> news:ubg7WH3aFHA.2440@TK2MSFTNGP10.phx.gbl...> > Hi, I have the following problem...
> >
> > Pre-requisites:
> > Installation of an Asp.net webservice on a IIS5 server (win2k).group -->> > access is not allowed, only using windows authentication (intranet app),
> > webmethoda are using the Principalpermssion attribute
> > ([PrincipalPermission(SecurityAction.Demand,
> > Role=@"DomainName\WindowsGroup...")]) for identification.
> >
> > Result --> does not work
> >
> > When I change the to [PrincipalPermission(SecurityAction.Demand,
> > name=@"DomainName\Windowsuser...")]) -> it runs fine
> >
> > --> conclusion: IIS cannot determine if a user belongs to an AD>> > IPrincipal.IsInRole(@"DomainName\WindowsGroup") is always FALSE!
> >
> > I already found an article on the web
> > ([url]http://www.kbalertz.com/kb_894432.aspx[/url] --> web dir is UNC share), but
> > didn't solved the problem...
> >
> > Does anyone know more about this issue?
> >
> > Thanks
> > Oliver Rainer
> >
> >
> >
>
Oliver Rainer Guest
-
Joseph Bittman MCAD #4
Re: User.IsInRole is always FALSE
June 9, 2005
:-) Yes, the BUILTIN will only work for local groups. AD groups are
somewhat more mysterious and have had problems with them myself. When you
call IsInRole, where is the IPrincipal coming from? Are you using the
interface directly, or using an object taken from the
System.Threading.Thread.CurrentPrincipal, or the User object???? This makes
a big difference in the result that you will get, because I believe in your
case that only a principal taken from User will reflect the user's identity
and not ASPNET. If you could post how you got Iprincipal.IsInRole, then I
believe that I can help you further! :-) Have a great day and until later!!!
--
Joseph Bittman Beta ID# 678424
Microsoft Certified Application Developer
Web Site: [url]http://71.35.110.42[/url]
Dynamic IP -- Check here for future changes
"Oliver Rainer" <olrainer@tiscali.ch> wrote in message
news:O$%23NC1$aFHA.1044@TK2MSFTNGP10.phx.gbl...> Thanks for your suggestion... that really works for local groups
> (BUILTIN),
> but IIS still has the problem to resolve AD groups (OURDOMAIN\...)... The
> strange thing is that on certain machines (our developer machines), IIS
> can
> succesfully determine if a user belongs to an AD group...
>
> Do you have other suggestions??
>
> Thanks
> Oliver Rainer
>
>
> "Joseph Bittman MCAD" <RyanBittman@msn.com> wrote in message
> news:eIRT4F4aFHA.3280@TK2MSFTNGP12.phx.gbl...> you>> June 7, 2005
>>
>> hehe I actually have to go to a meeting right now, but a quick
>> suggestion
>> before I leave. Try switching the PrincipalPermission
>> role="domain\groupname" to "BUILTIN\GROUPNAME". There is a little more to
>> this change, but it should work.... depending on which role it is, so if> Anonymous>> could post it, that would really help... until later! :-)
>>
>> --
>> Joseph Bittman
>> Microsoft Certified Application Developer
>>
>> Web Site: [url]http://71.35.110.42[/url]
>> Dynamic IP -- Check here for future changes
>>
>> "Oliver Rainer" <olrainer@tiscali.ch> wrote in message
>> news:ubg7WH3aFHA.2440@TK2MSFTNGP10.phx.gbl...>> > Hi, I have the following problem...
>> >
>> > Pre-requisites:
>> > Installation of an Asp.net webservice on a IIS5 server (win2k).> group -->>> > access is not allowed, only using windows authentication (intranet
>> > app),
>> > webmethoda are using the Principalpermssion attribute
>> > ([PrincipalPermission(SecurityAction.Demand,
>> > Role=@"DomainName\WindowsGroup...")]) for identification.
>> >
>> > Result --> does not work
>> >
>> > When I change the to [PrincipalPermission(SecurityAction.Demand,
>> > name=@"DomainName\Windowsuser...")]) -> it runs fine
>> >
>> > --> conclusion: IIS cannot determine if a user belongs to an AD>>>>> > IPrincipal.IsInRole(@"DomainName\WindowsGroup") is always FALSE!
>> >
>> > I already found an article on the web
>> > ([url]http://www.kbalertz.com/kb_894432.aspx[/url] --> web dir is UNC share),
>> > but
>> > didn't solved the problem...
>> >
>> > Does anyone know more about this issue?
>> >
>> > Thanks
>> > Oliver Rainer
>> >
>> >
>> >
>>
>
Joseph Bittman MCAD Guest
-
Oliver Rainer #5
Re: User.IsInRole is always FALSE
Hi Joseph,
I executed the following code for testing the stuff --> all booleans were
false except the local admin groups...
WindowsPrincipal windowsPrincipal =
(WindowsPrincipal)Thread.CurrentPrincipal;
IPrincipal iPrincipal = Thread.CurrentPrincipal;
WindowsIdentity windowsIdentity =
System.Security.Principal.WindowsIdentity.GetCurre nt();
string user = windowsIdentity.Name;
bool isLocalAdmin =
windowsPrincipal.IsInRole(WindowsBuiltInRole.Admin istrator);
bool isInTestgroup1 = windowsPrincipal.IsInRole(@"DOMAIN\Testgroup1");
bool isInTestgroup2 = windowsPrincipal.IsInRole(@"DOMAIN\Testgroup2");
bool isLocalAdmin_2 = iPrincipal.IsInRole(@"BUILTIN\Administrators");
bool isInTestgroup1_2 = iPrincipal.IsInRole(@"DOMAIN\Testgroup1");
bool isInTestgroup2_2 = iPrincipal.IsInRole(@"DOMAIN\Testgroup2");
Thanks for your help...
Oliver Rainer
"Joseph Bittman MCAD" <RyanBittman@msn.com> wrote in message
news:OJWiWGEbFHA.3032@TK2MSFTNGP10.phx.gbl...makes> June 9, 2005
>
> :-) Yes, the BUILTIN will only work for local groups. AD groups are
> somewhat more mysterious and have had problems with them myself. When you
> call IsInRole, where is the IPrincipal coming from? Are you using the
> interface directly, or using an object taken from the
> System.Threading.Thread.CurrentPrincipal, or the User object???? Thisyour> a big difference in the result that you will get, because I believe inidentity> case that only a principal taken from User will reflect the user'slater!!!> and not ASPNET. If you could post how you got Iprincipal.IsInRole, then I
> believe that I can help you further! :-) Have a great day and untilThe>
> --
> Joseph Bittman Beta ID# 678424
> Microsoft Certified Application Developer
>
> Web Site: [url]http://71.35.110.42[/url]
> Dynamic IP -- Check here for future changes
>
> "Oliver Rainer" <olrainer@tiscali.ch> wrote in message
> news:O$%23NC1$aFHA.1044@TK2MSFTNGP10.phx.gbl...> > Thanks for your suggestion... that really works for local groups
> > (BUILTIN),
> > but IIS still has the problem to resolve AD groups (OURDOMAIN\...)...to> > strange thing is that on certain machines (our developer machines), IIS
> > can
> > succesfully determine if a user belongs to an AD group...
> >
> > Do you have other suggestions??
> >
> > Thanks
> > Oliver Rainer
> >
> >
> > "Joseph Bittman MCAD" <RyanBittman@msn.com> wrote in message
> > news:eIRT4F4aFHA.3280@TK2MSFTNGP12.phx.gbl...> >> June 7, 2005
> >>
> >> hehe I actually have to go to a meeting right now, but a quick
> >> suggestion
> >> before I leave. Try switching the PrincipalPermission
> >> role="domain\groupname" to "BUILTIN\GROUPNAME". There is a little moreif> >> this change, but it should work.... depending on which role it is, so>> > you> > Anonymous> >> could post it, that would really help... until later! :-)
> >>
> >> --
> >> Joseph Bittman
> >> Microsoft Certified Application Developer
> >>
> >> Web Site: [url]http://71.35.110.42[/url]
> >> Dynamic IP -- Check here for future changes
> >>
> >> "Oliver Rainer" <olrainer@tiscali.ch> wrote in message
> >> news:ubg7WH3aFHA.2440@TK2MSFTNGP10.phx.gbl...
> >> > Hi, I have the following problem...
> >> >
> >> > Pre-requisites:
> >> > Installation of an Asp.net webservice on a IIS5 server (win2k).> > group -->> >> > access is not allowed, only using windows authentication (intranet
> >> > app),
> >> > webmethoda are using the Principalpermssion attribute
> >> > ([PrincipalPermission(SecurityAction.Demand,
> >> > Role=@"DomainName\WindowsGroup...")]) for identification.
> >> >
> >> > Result --> does not work
> >> >
> >> > When I change the to [PrincipalPermission(SecurityAction.Demand,
> >> > name=@"DomainName\Windowsuser...")]) -> it runs fine
> >> >
> >> > --> conclusion: IIS cannot determine if a user belongs to an AD> >> >> > IPrincipal.IsInRole(@"DomainName\WindowsGroup") is always FALSE!
> >> >
> >> > I already found an article on the web
> >> > ([url]http://www.kbalertz.com/kb_894432.aspx[/url] --> web dir is UNC share),
> >> > but
> >> > didn't solved the problem...
> >> >
> >> > Does anyone know more about this issue?
> >> >
> >> > Thanks
> >> > Oliver Rainer
> >> >
> >> >
> >> >
> >>
> >>
> >
>
Oliver Rainer Guest
-
WirelessBen #6
Re: User.IsInRole is always FALSE
Hi Oliver,
I was able to fix this problem by changing the web.config file fro
mode="None" to mode="Windows" in the authentication section, e.g.
<authentication mode="Windows" />
Cheers
--
WirelessBe
-----------------------------------------------------------------------
WirelessBen's Profile: [url]http://www.highdots.com/forums/member.php?userid=23[/url]
View this thread: [url]http://www.highdots.com/forums/showthread.php?t=148294[/url]
WirelessBen Guest
-
Oliver Rainer #7
Re: User.IsInRole is always FALSE
Thanks for your suggestion...
I checked the setting in web.configm and it was already set to "Windows"..
;-(
"WirelessBen" <WirelessBen.1qf8c1@no-mx.forums.yourdomain.com.au> wrote in
message news:WirelessBen.1qf8c1@no-mx.forums.yourdomain.com.au...[url]http://www.highdots.com/forums/member.php?userid=232[/url]>
> Hi Oliver,
>
> I was able to fix this problem by changing the web.config file from
> mode="None" to mode="Windows" in the authentication section, e.g.
>
> <authentication mode="Windows" />
>
> Cheers!
>
>
> --
> WirelessBen
> ------------------------------------------------------------------------
> WirelessBen's Profile:> View this thread: [url]http://www.highdots.com/forums/showthread.php?t=1482941[/url]
>
Oliver Rainer Guest
-
CodeMeister #8
Re: User.IsInRole is always FALSE
Setting up an ASP.Net application to use Windows authentication is generally
a two step process depending on how your server is configured. You need to
set the mode atribute of the authentication element to "Windows" as stated.
The second part that seems to trip people is you need to go the the IIS
manager console, write click on your application, select properties, select
the directory security tab, under Anonymous access and authentication
control select the edit button, make sure Anonymous access is unchecked and
Integrated Windows authentication is checked. This will now force requests
to authenticate.
You should be able to capture the actual requester. You may need to check
the System.Thread.Threading.CurrentPrincipal,
System.Web.HttpContext.Current.User, and
System.Security.Principal.WindowsIdentity.GetCurre nt() to see which one has
the actual account you need. These values can be different based on your
configuration settings.
If you can't find the user in nay of these, you may also need to add an
identity element to your web.config with the impersonate attribute set to
true.
IHTH
Jon
"Oliver Rainer" <olrainer@tiscali.ch> wrote in message
news:uOIRXU%23bFHA.2984@TK2MSFTNGP15.phx.gbl...> Thanks for your suggestion...
> I checked the setting in web.configm and it was already set to "Windows"..
> ;-(
>
>
> "WirelessBen" <WirelessBen.1qf8c1@no-mx.forums.yourdomain.com.au> wrote in
> message news:WirelessBen.1qf8c1@no-mx.forums.yourdomain.com.au...> [url]http://www.highdots.com/forums/member.php?userid=232[/url]>>
>> Hi Oliver,
>>
>> I was able to fix this problem by changing the web.config file from
>> mode="None" to mode="Windows" in the authentication section, e.g.
>>
>> <authentication mode="Windows" />
>>
>> Cheers!
>>
>>
>> --
>> WirelessBen
>> ------------------------------------------------------------------------
>> WirelessBen's Profile:>>> View this thread: [url]http://www.highdots.com/forums/showthread.php?t=1482941[/url]
>>
>
CodeMeister Guest



Reply With Quote

