Re: ASP.NET 2.0 Authorization Roles



what does Context.User.Identity.Name say - the username you are expecting?

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

As you said, I have modified the web.config as:

<authorization>
<allow roles="MyDomain\\WMS_ADMINISTRATORS"/>
</authorization>
And the Page_Load Code is:

protected void Page_Load(object sender, EventArgs e)
{
if (Context.User.IsInRole("MyDomain\\WMS_ADMINISTRATORS"))
{
Label1.Text = Context.User.Identity.Name + " is part of
ROLE";
}
else
{
Label1.Text = Context.User.Identity.Name + " is NOT part
of
ROLE";
}
}
What am I missing here? I have verified that current logged on user is
part of MyDomain\\WMS_ADMINISTRATORS group.

"Dominick Baier [DevelopMentor]"
<dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4580be6319936c8c8252d26f58370@xxxxxxxxxxxxxxxxxxxxx

hi,
you have to use the domain\groupname format for windows groups.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
Hi,

I am facing a weird problem related to ASP.NET 2.0 Roles. I have
web.Config file having security settings:

<authentication mode="Windows"/>

<authorization>

<allow roles=".\WMSAdmin" />

</authorization>

And during Page_Load() event, when I check whether current logged on
user is in the Role specified then it fails, however, the user is
part of this Role on the local machine:

If Not Page.User.IsInRole("WMSAdmin") Then

Trace.Write("Page user is NOT part of WMSAdminGroup")

Server.Transfer("~/NoAccess.aspx")

Else

Trace.Write("Page user " & Page.User.Identity.Name & " is PART of
WMSAdmin Group.")

End If

Any guesses, what am I missing here.
Regards,
Atul


.



Relevant Pages