C# 我需要将当前用户名填充到";用户名";Identity Server自定义登录页的字段

C# 我需要将当前用户名填充到";用户名";Identity Server自定义登录页的字段,c#,html,identityserver3,C#,Html,Identityserver3,在下面的Identity Server 3链接中,我必须填写用户名和密码才能登录 但是,我需要的是,在登录页面在屏幕上闪烁系统的Windows用户名之前,用户名应该自动填写。为此,我尝试了以下方法,我在这里介绍了这些方法,也在回答这个问题时介绍了这些方法: 但这只适用于Internet explorer,因为它有ActiveX,而ActiveX只在Internet explorer中受支持 (System.Environment.Username) 函数GetUsername() { var

在下面的Identity Server 3链接中,我必须填写用户名和密码才能登录

但是,我需要的是,在登录页面在屏幕上闪烁系统的Windows用户名之前,用户名应该自动填写。为此,我尝试了以下方法,我在这里介绍了这些方法,也在回答这个问题时介绍了这些方法:

但这只适用于Internet explorer,因为它有ActiveX,而ActiveX只在Internet explorer中受支持 (System.Environment.Username)

函数GetUsername()
{
var wshshell=newActiveXObject(“wscript.shell”);
var username=wshshell.expandEnvironmentString(“%username%”);
document.getElementById(“用户名”).value=username;
}
我从中调用了此方法,但这只提供Internet explorer中的当前用户名。请有人建议我更好的答案,如果他们有任何想法。

System.Environment.Username
将为您提供登录计算机的用户的用户名,这可能不是您希望在网站上使用的用户名。对于服务器,这可能是
IISUser
,或者可能是(希望不是)
Administrator
@Neil如果你查看我共享的链接,我需要在登录页面中填充用户名。IISUser会给我用户名吗?我能在html页面中写下这样的内容吗?不,
System.Environment.Username
在本地运行时提供您的名称,因为您已登录到运行代码的计算机。如果我访问您的网站,您是否希望它使用我的用户名?如果是这样的话,网站就不是这样工作的。是的,没错,但是你能建议我在Identity server的login.html页面中做些什么更改吗?通过这些更改,我可以在登录屏幕的登录页面加载中填充当前用户名。我想没有办法。当我登录不同的网站时,我使用2到3个不同的电子邮件地址用于不同的目的(一个用于工作,一个用于家庭等)。这在你的网站上是如何工作的,它会选择哪个“名称”?
<script>
function GetUsername()
{
var wshshell = new ActiveXObject("wscript.shell");
                var username = wshshell.ExpandEnvironmentStrings("%username%");
                document.getElementById("username").value  = username;
}
</script>

I called this method from <body lang="en" onload="GetUserName()">  but this only gives current username in Internet explorer. Please someone suggest me better answer if they have any idea.