在使用Windows身份验证启用和放Web服务器上运行Web应用程序获取客户端用户名;服务帐户 [英] Get Client User Name from a Web Application running in a Web Server with Windows Auth Enabled & Service Account

查看:157
本文介绍了在使用Windows身份验证启用和放Web服务器上运行Web应用程序获取客户端用户名;服务帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也遇到了以下问题,同时部署我的应用程序到Web服务器,

I have encounter the following issue while deploying my application into a WebServer,

在code,我已经是Usercheck = My.User.Name,但将返回运行Web应用程序我该实例的服务帐户,所以我需要显示evilla这是我当前的Windows凭据,当我尝试首次连接到它要求我的网络凭据。web应用程序

The code that i have was "Usercheck = My.User.Name" but that will return the Service Account for the instance that is running my webapp, so i need to display "evilla" which is my current windows credential, when i try to connect for the first time to the webapp it asks for my network credentials.

是否有可能抢我的Windows用户名,而不是服务帐户? (我远程conecting到应用程序)

Is it possible to grab my windows username and not the service account?? (i'm conecting remotely to the app)

我曾尝试:

   'Usercheck = Request.LogonUserIdentity.Name
    Usercheck = HttpContext.Current.Request.LogonUserIdentity.Name
    TextBox4_AddDataControl.Text = Usercheck
    TextBox6_AddDataControl.Text = Environment.UserName

我思念的东西??

Am i missing something??

注:我从上面的codeNA / SRS-SA获得(服务帐户)

Note: i'm getting from the above code "NA/SRS-SA" (service account)

感谢您!!

推荐答案

更​​多的研究后,低于code返回是在服务帐户的时间登录的用户。

After more research, the below code returned the user that is logged at the time in the service account.

        TextBox6_AddDataControl1.Text = Request.ServerVariables("LOGON_USER")

希望它可以帮助别人的未来! :)

Hope it helps someone in the future! :)

这篇关于在使用Windows身份验证启用和放Web服务器上运行Web应用程序获取客户端用户名;服务帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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