0
votes

I am developing an ASP.NET MVC3 application with C# and Razor. I set up the authentication mechanism to my application as Windows authentication.

The network uses an Active Directory which I use to authenticate the user. Now I would like to create a visit log to trace the (intranet) users that access the application and which operation they perform.

How can I, by using c# code, get from Active Directory the username of the users that is currently in my application?

Thanks

Francesco

1

1 Answers

0
votes

Inside an MVC controller:

string username = User.Identity.Name;

(provided that the site uses windows authentication)