如何获得Window用户身份? " User.Identity.Name"返回应用程序池标识而不是Windows用户 [英] How to get Window user Identity? "User.Identity.Name" returning App Pool Identity instead of Windows User

查看:183
本文介绍了如何获得Window用户身份? " User.Identity.Name"返回应用程序池标识而不是Windows用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS上部署了一个MVC 4应用程序。我试图让Windows用户在代码中如下,但它让我的应用程序池用户。

I have a MVC 4 application deployed on IIS. I am trying to get the Windows user in code as following but its reuring me the App Pool user.

控制器内部代码获取用户:

Code Inside Controller to get User:

User.Identity.Name

我试图将应用程序池标识分为本地系统,NetworkSystem和ApplicationPoolIdentity。然后它停止了回撤任何事情。

I have tried to chaged the App pool Identity to Local System, NetworkSystem and ApplicationPoolIdentity. But then it stoped returing anything back.

我正在寻找的是我不希望登录提示屏幕在用户点击网站时显示,网站应该自动进行选择系统用户并相应地显示结果。

What I am looking for it that I don't want Login prompt screen to be displayed when user hit the site, site should autometically pick the System user and display the results accordingly.

配置如下:

<authentication mode="None"/>

提前致谢

推荐答案

应用程序池中的更改对我有用。

Change in Application pool worked for me.

在应用程序池中将加载用户设置更改为 true 高级设置,它工作。

Changed Load User Settings to true in application pool advanced settings and it worked.

这篇关于如何获得Window用户身份? &QUOT; User.Identity.Name&QUOT;返回应用程序池标识而不是Windows用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆