after user sign in. I save their username into the cookie.
FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
User has roles, "member", "staff", "manager"
for those page that only manager are allowed to enter. What I did right now is to query the DB using their username.
GetRoles(username)
That generates alot overhead, every time they visit a role protected page, I need to check the DB.
I am wondering if I can make SetAutheCookie to set a few values, not just the username.
What I did right now to combine username, roles in one string.
FormsAuthentication.SetAuthCookie(userName + "|" + role.tostring(), createPersistentCookie);
this definitely not the best solution.