Hi there
I have a base page (inherited from System.Web.UI.Page and all my pages inherit from this base page) in my .Net web application and at the moment if I put the following methods
protected void CheckAllowedRole(string UserName, List<string> AllowedRoles)
{
try
{
bool IsAllowed = false;
foreach (string item in AllowedRoles)
{
if (Roles.IsUserInRole(UserName, item))
IsAllowed = true;
}
if (!IsAllowed)
Response.Redirect("~/Members/Error.aspx", false);
}
catch (Exception err)
{
Response.Redirect("~/Members/Error.aspx", false);
}
}
for somereason it doesn't know the role is!?!? Return. I even pass the username into this methods and still doesn't work either.
But if I take this code and put into my page which inherited from this base page works well (no issue). Any ideas? Is there any restriction on the Roles (or Membership provider in the base class).
Thanks