I’m trying to solve the problem: when a user is being logged into a WebSite (via user control .ascx stored on the Master Page), it’s name is being stored in a Page.User.Identity.Name property. OK, but how to retrieve that user name in the controller ? Is it possible without registering System.Security.Principal namespace in the controller ? In the other words – the controller must know whose user wants to do some action (e.g. change account data). I could store it’s name in the Html.Hidden control on each View but I don’t want to have a mess in my Views
Share
IPrincipal Useris one of the members in your controller (it is a property), so all you have to do to get the name of the currently logged in user in your controller method is