I have a question: how do I get the user logged in to windows on the client machine? It is taking the user from the server and not from the client machine. Could you help me?
I have a question: how do I get the user logged in to windows on the client machine? It is taking the user from the server and not from the client machine. Could you help me?
In creating the project, Visual Studio offers this option.
When creating a project, click Change Authentication as in the screen below:
Onthenextscreen,clickWindowsAuthentication:
Iftheprojectalreadyexists,modifythefollowinginyourweb.config
:
<configuration>...<system.web><compilationdebug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
...
</configuration>
The user name will be in Controllers and Views , within User.Identity.Name
.