如何获取域登录用户名 [英] How to get domain login username
问题描述
<! - 开始验证模式 - >
< < span class =code-leadattribute> authentication mode = 表单 lockItem = true >
< 表格 cookieless = UseCookies enableCrossAppRedirects = false protection = All defaultUrl = 登录 loginUrl = 登录 名称 = 。SAMPE_AUTH_CODE timeout = 20 / >
< / authentication >
< span class =code-keyword>< identity impersonate = true / >
我可以通过
获取UserName
Environment.UserName
在为应用程序生成开发和表单时使用
但是在部署之后它不起作用意味着域用户名无法获取.....
它应该弹出用户名密码对话框,它不应该给它应该采用他用来登录系统的域名用户名........ ......
这篇关于如何获取域登录用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
其次,如果你想要客户端要静默地对您的站点进行身份验证,而不提示用户输入用户名和密码,则客户端需要是与服务器相同的Active Directory域的成员,并且该站点需要位于客户端的本地Intranet区域中。
注意:在Internet Explorer设置中将站点添加到本地Intranet区域将影响Internet Explorer,Edge和Chrome。要在Firefox中获得相同的结果,您需要修改配置:
在Firefox中启用NTLM身份验证(单点登录) [ ^ ]
<!--Start Authenticate Mode-->
<authentication mode="Forms" lockItem="true">
<forms cookieless="UseCookies" enableCrossAppRedirects="false" protection="All" defaultUrl="Login" loginUrl="Login" name=".SAMPE_AUTH_CODE" timeout="20" />
</authentication>
<identity impersonate ="true"/>
I am able to fetch UserName by
Environment.UserName
while doing development and form ticket generated for application
but after deployment its not working means Domain username not able to fetch.....
It should give pop up for username password dialog it should not give it should take Domain username which he use to login to system..............Firstly, if you want to use Windows authentication, you need to configure your site to use Windows authentication, not Forms authentication.
Secondly, if you want the client to silently authenticate to your site, without prompting the user for a username and password, then the client needs to be a member of the same Active Directory domain as the server, and the site needs to be in the client's "Local Intranet" zone.
NB: Adding the site to the "Local Intranet" zone in the Internet Explorer settings will affect Internet Explorer, Edge, and Chrome. To get the same result in Firefox, you'll need to modify the configuration:
Enabling NTLM Authentication (Single Sign-On) in Firefox[^]