Possible Duplicate:
How do you get the UserID of a User object in ASP.Net MVC?
Greetings, I have created a custom membership provider to make it possible to authenticate users on my application. How can i retrieve current user id in controller? I need this to get some data from database for this user like this:
PersistanceManger.RepositoryUser.GetInformation(userROWGUID);
Do you particularly need the Id of the user or the userName ?, it seems you are looking for the Guid of the present user, for this I think the retrieval of this Id depends on your implementation. If you want to retrieve information based of userName, then you can do the following:
HttpContext.Current.User
gives you the User object, you can get the other information from it, for your case, you need to use HttpContext.Current.User.Identity.Name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With