Click here to Skip to main content
15,068,646 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
So, I've been pulling my hair out trying to get the user id out of my application. I'm using the Visual Studio 2013 Preview for Web. I know back in the day, you'd call the Membership object and get the Username or ID out of that. I'm trying to get the User ID so I can add a user to a role calling IdentityConfig.Roles.AddUserToRole. I came close when I tried instantiating a new <ProjectName>.Models.IdentityModels.User user = new Models.IdentityModels.User(); using the blank constructor, but it didn't give me the current user, just a random id. It's a webform project, if that helps (it's not supposed to make a difference now, is it?).

PS, the Context.Current.User and Page.User give me the UserName, but not the ID.

Thanks for any help you guys can give.
Posted
Updated 10-Sep-13 7:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900