J
Jason
I'm trying to implement role-based security in my ASP.NET application,
however, everytime I perform an IsInRole check, it ALWAYS returns
false! My Web.Config file has the following entry:
<authentication mode="Windows" />
Here is sample code that returns false:
private void Page_Load(object sender, System.EventArgs e)
{
lblOutput.Text = RoleTest();
}
private string RoleTest()
{
//return Context.User.Identity.Name.ToString();
return Context.User.IsInRole("MYDOMAIN\\Administrators").ToString();
}
The first line in RoleTest(), where it returns
Context.User.Identity.Name works and returns the name of the logged on
user. But the second line, always returns false no matter what I check
for!
This is all I have done to implement Role-Based security. Is there
more setup that has to be done? Do I have to populate roles, or
initialize WindowsPrincipal objects, or what?
Thanks for the help!
however, everytime I perform an IsInRole check, it ALWAYS returns
false! My Web.Config file has the following entry:
<authentication mode="Windows" />
Here is sample code that returns false:
private void Page_Load(object sender, System.EventArgs e)
{
lblOutput.Text = RoleTest();
}
private string RoleTest()
{
//return Context.User.Identity.Name.ToString();
return Context.User.IsInRole("MYDOMAIN\\Administrators").ToString();
}
The first line in RoleTest(), where it returns
Context.User.Identity.Name works and returns the name of the logged on
user. But the second line, always returns false no matter what I check
for!
This is all I have done to implement Role-Based security. Is there
more setup that has to be done? Do I have to populate roles, or
initialize WindowsPrincipal objects, or what?
Thanks for the help!