Catch AD user asp net mvc

1

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?

    
asked by anonymous 15.08.2015 / 15:49

1 answer

1

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 .

    
15.08.2015 / 22:06