I am working on a MVC 3 intranet application ( windows authentication ). I want the username of current logged in user in my controller action. I have tried lot of variation but cannot get the username . I tried using Environment.Username
it worked well in debug mode but when deployed it provided the pool name rather than the username.
Controller action.
public ActionResult Index()
{
LoggedUser usr = new LoggedUser();
var aa = usr.User;
}
LoggedUser
public class LoggedUser : Controller
{
public LoggedUser()
{
}
}
I was following this post but was not able to make it work Getting the logged in username in ASP.NET MVC3 intranet application
Any help??