To retrieve the currently logged in username you could use the User.Identity.Name
property inside your action:
public ActionResult Index()
{
string usr = User.Identity.Name;
...
}
The code you have shown in your question is incorrect. You have defined a LoggedUser
and are instantiating this controller inside some Index
action. You are not supposed to instantiate controllers manually. That's the responsibility of the framework.