如何从IIS上的已发布网站获取客户端Windows身份?

时间:2014-12-24 10:15:49

标签: c# asp.net iis single-sign-on windows-identity

同一域中的服务器和客户端。我试图从IIS上的已发布网站获取客户端Windows身份。

WindowsIdentity identity = WindowsIdentity.GetCurrent();
string userNameWithDomain = identity.Name.ToString();
string identityName = HttpContext.Current.Request.LogonUserIdentity.Name;
string userName = HttpContext.Current.User.Identity.Name;

顺便说一下,我不想在任何地方输入用户名和密码......

我已尝试过零件和零件组合,但网页仍然需要用户名和密码

enter image description here

  • Windows身份验证

enter image description here

如果iispool(自动测试)是默认值并启用了Windows身份验证,则结果为

userNameWithDomain = "FALAN\Filan"// Server Identity name
identityName = "IIS APPPOOL\autotest"// IIS Pool
userName  = "FALAN\Bilgehan" // After I typed the username and password, this variable gives me the correct answer. However as you can see up, i dont want to type username and password to anywhere
  • IIS池

我输入了iispool的自定义帐户信息

enter image description here

userNameWithDomain = "FALAN\Filan"// Server Identity name
identityName = "FALAN\Filan"// Server Identity name
userName  = "FALAN\Bilgehan" // After I typed the username and password, this variable gives me the correct answer. However as you can see up, i dont want to type username and password to anywhere
  • Web Config

我做了identity impersonate="true"

我做了authentication mode="Windows"

  • Visual Studio

enter image description here

正如你所看到的,我无法找到正确答案。如何在不输入用户名和密码的情况下从IIS上的已发布网站获取客户端Windows身份?

...谢谢

0 个答案:

没有答案