My authentication stopped working all of a sudden and recent backps do not seem to do the trick. Can any of you see what is wrong, at the loginpage I verify the user and assign the user the "admin" role like this:
if (isAdmin(email, password))
{
loadAdmin(email, password);
strRole = "admin";
ticket = new FormsAuthenticationTicket(1, email, DateTime.Now, DateTime.Now.AddMinutes(30), false, strRole, FormsAuthentication.FormsCookiePath);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)));
Response.Redirect("admin_pages_admin.aspx");
}
At the "admin_pages_admin.aspx" page I have this.
{
loadAdmin(email, password);
strRole = "admin";
ticket = new FormsAuthenticationTicket(1, email, DateTime.Now, DateTime.Now.AddMinutes(30), false, strRole, FormsAuthentication.FormsCookiePath);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)));
Response.Redirect("admin_pages_admin.aspx");
}
At the "admin_pages_admin.aspx" page I have this.
if (!Page.User.IsInRole("admin") && !Page.User.IsInRole("user"))
Response.Redirect("admin_pages_default.aspx");
This evaluates to true and I'm redirected to the loginpage

Shweta LodhaRank #31 · 39.8K reputationPosted Mar 30, 2014, 8:10 AM EDT
Mats A54 reputationPosted Mar 30, 2014, 9:31 PM EDT
Shweta LodhaRank #31 · 39.8K reputationPosted Apr 1, 2014, 11:22 AM EDT
Mats A54 reputationPosted Apr 1, 2014, 11:27 AM EDT
Mats A54 reputationPosted Apr 9, 2014, 9:30 PM EDT