Redirecting the Users to different page based on there roles
Hi,
While working with login control , you may need to redirect each user for a different page based on there roles.To do this , you can handle the LoggedIn event of login control( which will be fired after the user logged in successfully)
protected void Login1_LoggedIn(object sender, EventArgs e)
{
// please don't use User.IsInRole here , because it will not be populated yet at this stage.
if (Roles.IsUserInRole(Login1.UserName, "Admins"))
Response.Redirect("~/Admins/Default.aspx");
else if (Roles.IsUserInRole(Login1.UserName, "Editors"))
Response.Redirect("~/Editors/Default.aspx");
}
Regards,
Anas Ghanem