I want to redirect people according to their role in asp.net membership provider. I have code in the OnLoggedIn event on the login page. Here is what I have tried so far and nothing works:
The code below returns false in the step .IsAuthenticated, it says that the user is not authenticated. At what stage on the login page the user is authenticated, I thought that the OnLoggedIn event is the right place for this.
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
}
}
}
The second thing I tried is to get all the roles for the user, but returns nothing, returns an empty array of strings, and I checked the database that the role was assigned to this specific user. This is how I try:
string[] userRole = Roles.GetRolesForUser(LoginUser.UserName);
, , , - - .
, Laziale