SimpleMembershipProvider roles not accessible
问题 I have MVC4 application which uses SimpleMEmbershipProvider for authentication mechanism. Everything works fine, apart of when I return to the application and authenticate using persistant cookie. I am authenticated fine, but cannot access roles that I am assigned to. Effectively, cannot access roles at all: string.Join(",", Roles.GetRolesForUser(User.Identity.Name)) returns empty string What might be causing that? 回答1: This can happen when the SimpleMembershipProvider hasn't been initialized