With windows authentication, The trust relationship between the primary domain and the trusted domain failed, when calling IsInRole

感情迁移 提交于 2019-12-22 05:10:46

问题


I have my asp.net web server setup to use windows authentication.

It is authenticating just fine with my current logged in user.

I can verify this by viewing ...

HttpContext.Current.User.Identity.Name

And I can verify that I am authenticated by viewing...

HttpContext.Current.User.Identity.IsAuthenticated

However, when I call the .IsInRole function I get the trust relationship error...

HttpContext.Current.User.IsInRole("accounting")

I have found online references to problems with supplying domain name with the role name (domain\accounting), but I still get the same error. Any suggestions on where to look or troubleshoot the problem?


回答1:


Well, it seems that if you are referencing a Role that doesn't exist then you get the trusted domain error.

The error went away and the code functioned just fine when I changed from ...

HttpContext.Current.User.IsInRole("accounting") 

to the actual group name ...

HttpContext.Current.User.IsInRole("rsi_accounting") 


来源:https://stackoverflow.com/questions/2625509/with-windows-authentication-the-trust-relationship-between-the-primary-domain-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!