从mvc应用程序获取当前系统用户

时间:2018-11-28 07:17:36

标签: model-view-controller asp.net-identity

我正在使用mvc 5进行登录,我具有用户asp.net身份。作为一项要求,我需要获取系统用户名并进行身份验证,如果用户通过身份验证,则绕过Identity登录。

为此,我使用以下代码在 Login 类中获得系统用户。

 componentDidMount(){
            Tracker.autorun(async () => {
                Meteor.subscribe('allUsers');
                const userId = this.props.location.state.event.userID;
                const eventUser = await Meteor.users.findOne({_id: userId});
                this.setState({ eventUser });
            });
        }

如果我像下面那样更改IIS设置,这将返回HTTP错误404.15-未找到 Windows身份验证=>启用 匿名身份验证=>禁用 enter image description here

我是MVC身份框架的新手,请帮助我。谢谢!

0 个答案:

没有答案
相关问题