1
在Internet mvc 4項目中,當以調試模式運行項目並登錄到應用程序時,用戶的角色是之前分配將會被認可。我使用的獲取用戶角色的功能是:System.Web.Security.Roles.GetRolesForUser(currentUser.Identity.Name)只有一次工作正確
System.Web.Security.Roles.GetRolesForUser(currentUser.Identity.Name)
但是當我停止調試,並再次運行在調試模式下的應用程序,用戶進行身份驗證,但GetRolesForUser返回字符串[0]。爲什麼它發生並且不返回角色?