📅  最后修改于: 2022-03-11 14:48:39.089000             🧑  作者: Mango
String[] newRoles = { "Administrator", "Customer" };
GenericIdentity newIdentity = new GenericIdentity(model.AccountName);
GenericPrincipal newPrincipal = new GenericPrincipal(newIdentity, newRoles);
System.Web.HttpContext.Current.User = newPrincipal;