1
在Internet mvc 4项目中,当以调试模式运行项目并登录到应用程序时,用户的角色是之前分配将会被认可。我使用的获取用户角色的功能是:System.Web.Security.Roles.GetRolesForUser(currentUser.Identity.Name)只有一次工作正确
System.Web.Security.Roles.GetRolesForUser(currentUser.Identity.Name)
但是当我停止调试,并再次运行在调试模式下的应用程序,用户进行身份验证,但GetRolesForUser返回字符串[0]。为什么它发生并且不返回角色?