在项目中遇到需要获取客户端登录的域账号信息的需求.
关键部分在于服务器的iis配置
1.确保服务器接入对应的域里面,使用域账号登录的。
2.iis需要设置为windows身份认证
3.我使用webform开发对应站点,通过request.ServerVariables["LOGON_USER"]获取账号
web.config需要对应配置
<authentication mode="Windows"/>
<authorization>
<allow user="*"/>
</authorization>
<modules>
<remove name="FormsAuthenticationModule"/>
<remove name="FormsAuthentication"/>
</modules>
4. Startup中ConfigureAuth,方法体注释掉