0

I have a web program In asp.net and c#. In my application I want get the current windows username and save it on a variable.If I run my app in local I can do it easily but when I run my app from server How can I do it? It means How can I get current user from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows \CurrentVersion\ Authentication /LogonUI and save it on a variable?

2 Answers 2

1

You cannot do this. You cannot get the logon username of the computer that the web browser is running on. And for good reasons, you would read data that you have no business reading. If you need that username, have the user enter it.

Sign up to request clarification or add additional context in comments.

Comments

0

in c# you can get the windows identity by string variable = System.Environment.UserName

i hope this helped.

1 Comment

This will get you the user logged on to the server, not the username of the guy in front of his browser using the site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.