Reputation: 5
I have a problem with my role redirection. Why my code
{
if (Roles.IsUserInRole(Login1.UserName, "Adminstrator"))
Response.Redirect("~/4_Admin/Page1.aspx");
else if (Roles.IsUserInRole(Login1.UserName, "Users"))
Response.Redirect("~/3_User/Expense.aspx");
}
is not working? It give me a headache after I spent like what, 3 days? Thank you for your time.
Upvotes: 0
Views: 82
Reputation: 1224
i have some suggestions,
1) first check ur conditions are correct. 2) debug the code and try to get any exception or not 3) if you are using try catch use response.redirect("path",false); 4) if you are hosting your application inside iis check your application virtual path. while hosting your application if your application is sub website of something else it will cause 404 error.
Upvotes: 0
Reputation: 3723
The role "Adminstrator" is missing the letter i - add that in and the first branch of the IF statement should start working.
Upvotes: 2