Reputation: 3293
How do I get the ID from the currently authenticated user in asp.net mvc
I asked this before How to tie SqlRoleProvider to "My" user table
And so now I am using this method to save the GUID from a new user into my table.
Guid id = MembershipService.GetUserID
So then I have that guid in my table as well as the built in authentication stuff. What I need to do now is when someone gets authenticated is to get the ID as a guid of the currently logged in user.
Is this possible and if so how?
If there is an easier way please let me know.
Thanks
Upvotes: 0
Views: 181
Reputation: 8214
You might want to look at some of the other answers on the site:
Your favorite "current user"-pattern for Asp.net applications?
Should I use the username, or the user's ID to reference authenticated users in ASP.NET
Getting the GUID of the current user?
Upvotes: 1