Using ASP.NET Web Admin tool, i created 5 users and assigned them to different roles, but when i try to user Roles.IsUserInRole, it doesn't work, please take a look here:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string username = Login1.UserName;
string password = Login1.Password;
if (!IsPostBack)
{
if (Membership.ValidateUser(username, password))
{
if (Roles.IsUserInRole("Saleman"))
Response.Redirect("~/Saleman.aspx");
else if (Roles.IsUserInRole("Accountant"))
Response.Redirect("~/Accountant.aspx");
else if (Roles.IsUserInRole("HR"))
Response.Redirect("~/HR.aspx");
//Always receive Attempt to login failed message !!
}
}
}