65117

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

Question:

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

Answer1:

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

Recommend

  • Office365 authentication without login redirection
  • OAuth2 flow for mobile app
  • Youtube Video Player Fullscreen click event
  • New-PSSession in an Azure-runbook (ARM)
  • conditions for accessors in Coldfusion ORM
  • Is there a Windows socket API call / option to “block” a range of ports à la SO_EXCLUSIVEADDRUSE
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Unable to connect to OnVif enabled camera using C#
  • Examples of how to a STS in .Net 4.5 using WCF
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Flash radiobutton: how do I get the selected radiobutton?
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Salesforce Different WSDL files and when to use
  • Dynamically switching connect in Modelica
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Redux Form - Not able to type anything in input
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • Is there any way to access browser form field suggestions from JavaScript?
  • Is there a amazon webstore API for customers?
  • Sony Xperia Z Tablet not found by adb
  • Javascript convert timezone issue
  • ActionScript 2 vs ActionScript 3 performance
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • To display the title for the current loaction in map in iphone
  • Circular dependency while pushing http interceptor
  • Traverse Array and Display in markup
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Acquiring multiple attributes from .xml file in c#
  • Getting error when using KSoap library to consume .NET web services
  • How to set the response of a form post action to a iframe source?
  • How do you join a server to an Active Directory (domain)?
  • Angular 2 constructor injection vs direct access
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • reshape alternating columns in less time and using less memory
  • How can I use threading to 'tick' a timer to be accessed by other threads?