在<authentication mode="Windows"/>
您的应用程序和 IIS 中启用匿名访问后,您将看到以下结果:
System.Environment.UserName: Computer Name
Page.User.Identity.Name: Blank
System.Security.Principal.WindowsIdentity.GetCurrent().Name: Computer Name
在<authentication mode="Windows"/>
您的应用程序中,禁用“匿名访问”并且在 IIS 中仅使用“集成 Windows 身份验证”,您将看到以下结果:
System.Environment.UserName: ASPNET (user account used to run ASP.NET service)
Page.User.Identity.Name: Domain\ Windows Account Name
System.Security.Principal.WindowsIdentity.GetCurrent().Name: Computer Name\ASPNET
在您的应用程序中,<authentication mode="Windows"/>
并且<identity impersonate ="true"/>
在 IIS 中禁用“匿名访问”并且仅使用“集成 Windows 身份验证”,您将看到以下结果:
System.Environment.UserName: Windows Account Name
Page.User.Identity.Name: Domain\ Windows Account Name
System.Security.Principal.WindowsIdentity.GetCurrent().Name: Domain\ Windows Account Name