7
I need to log the user into my system, with the user who is logged in to the company network. I’ve never done this and I’m having doubts about how to get users on AD. I’m doing research on the net and I still can’t understand how to find this user. The question is: How do I get the user logged in to the network and then on my system? Usage MVC5, Visual Studio 2013, C#.
So, I took this code from another forum and it worked, but there’s one boring thing still to solve. It brings me the domain and/or machine name, in this format: Domain User. How do I remove the domain and bar? Below is my solution:
public ActionResult CadastroCargo()
{
ViewBag.User = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
return View();
}
Man, I answered that question here
– Abner Terribili