在Angular 2/4应用程序中获取Windows用户名 [英] Get Windows Username within Angular 2/4 application

查看:119
本文介绍了在Angular 2/4应用程序中获取Windows用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用angular 2/4开发内部应用程序.所有应用程序都必须能够获取Windows计算机上已登录用户的用户名.角度应用程序将使用IIS和Windows身份验证进行托管.使用angularJS时,我使用Web表单作为索引页,并使用.NET获取Windows用户名并将用户名存储在网页上.

I just started using angular 2/4 to develop internal applications. All of the applications need to be able to get the username of the logged in user on windows machines. The angular applications will be hosted using IIS and Windows Authentication. When using angularJS I used a web form as the index page and got the windows username using .NET and storing the username on the webpage.

如何使用angular 2/4获取Windows用户名?我正在使用CLI创建应用程序.

How can I get the windows username using angular 2/4? I am using the CLI to create my applications.

非常感谢所有帮助.

推荐答案

您可以按以下说明将Angular CLI与Visual Studio和.Net一起使用: http://candordeveloper.com/2017/04/12/how-to-use-angular-cli-with-visual-studio-2017/

You can use Angular CLI with Visual Studio and .Net as described here: http://candordeveloper.com/2017/04/12/how-to-use-angular-cli-with-visual-studio-2017/

但是正如其他人所说,Angular是一个客户端Web框架,因此无法访问用户的Windows登录信息.

But as others have said, Angular is a client side web framework and as such cannot access the user's windows login info.

这篇关于在Angular 2/4应用程序中获取Windows用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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