I have an ASP.NET Role/Membership based forms authentication site. There's a subfolder and its pages which can be accessed only by a certain role. The problem is, login page does not display any error message if any user from non-allowed role group logins in login page. I mean, when a user from AllowedRole logins, the login page redirects the user correctly to the protected page, but when a user from NonAllowedRole tries to login, he/she correctly logs in but there are no error messages displayed, the user is back to the login page without any information. I do have a FailureText set in Login form but it's not displayed. loginForm.LoginError event is also doesn't get raised. I tried this code but it doesn't display either:
protected void frmLogin_LoggedIn(object sender, EventArgs e)
{
if (!User.IsInRole("AllowedRole"))
frmLogin.FailureText = "Access denied.";
//Label1.Text = "Access denied."; //doesn't work either
}
What am I doing wrong?