是否可以设置或更改System.Web.HttpContext.Current.Request.LogonUserIdentity.Name
以进行调试?我试过更改它,但它只读:
错误10属性或索引器' System.Security.Principal.WindowsIdentity.Name'无法分配 - 它是只读的
我尝试验证用户是否是特定活动目录组的成员,以从导航菜单中删除项目。所以我必须检查用户的群组,我可以更改HttpContext.Current.User.Identity.Name
进行调试但是System.Web.HttpContext.Current.Request.LogonUserIdentity.Name
我正在阅读群组:
List<string> groups = new List<string>();
foreach (System.Security.Principal.IdentityReference group in System.Web.HttpContext.Current.Request.LogonUserIdentity.Groups)
groups.Add(group.Translate(typeof(System.Security.Principal.NTAccount)).ToString());
谢谢!