简体   繁体   中英

Get Client User Name from a Web Application running in a Web Server with Windows Auth Enabled & Service Account

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

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.

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

i have tried:

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

Am i missing something??

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

Thank you!!

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! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM