c# - WindowsPrincipal.IsInRole 不适用于 IIS 7/Windows Server 2K8,但适用于 IIS 6/Win Server 2K3

标签 c# iis-7 iis-6 isinrole

IIS 7/Win Server 2008 中是否有某些设置或权限会导致 WindowsPrincipal.IsInRole 在 IIS 6/Win Server 2003 中运行相同代码时始终返回 false?以下是我调用该方法的方式:

IPrincipal principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
bool isInRole = principal.IsInRole("DOMAIN\Group"); // Always false in Win 2K8

Web 应用程序在两台服务器上都使用集成 Windows 身份验证运行。此外,Win 2008 服务器与 Win 2003 服务器位于不同的子域中。我要检查的组与 Win 2003 服务器位于同一子域中。

如有必要,我可以提供更多详细信息,但我不确定哪些是相关的,哪些是杂音。

最佳答案

如果“DOMAIN\Group”是组的全名,请检查域 Controller 。它必须是组名(Windows2000 之前)。

关于c# - WindowsPrincipal.IsInRole 不适用于 IIS 7/Windows Server 2K8,但适用于 IIS 6/Win Server 2K3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8081108/

相关文章:

iis-6 - 如何以编程方式禁用 iis 6 中的 Etag

C# 库根据您自己的数据库、facebook、twitter、OpenID 对用户进行身份验证,

c# - 如何在 .NET 中创建固定大小的线程池?

c# - 使用表单例份验证的 ASP.NET MVC 应用程序

c++ - 80040111 ClassFactory 无法提供请求的类(HRESULT 异常 : 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))

asp.net - Windows 7 上的等效 "aspnet_regiis -lk"是什么?

c# - ContinueWith 与一项任务中的顺序执行

iis-7 - 带 SSL 的 IIS 7 反向代理?

WCF (.NET 4.0) + IIS 7 + Windows 身份验证错误 - "service require Windows Authentication but it is not enabled for the IIS application "

iis - 使用 NTLM 避免每个请求出现 401 响应