Items. Should I store the User's
Item? Can I extend the
Userclass with an
I'm using "Individual User Accounts" from the MVC template.
'Membership.GetUser()' is null.
This question is tagged with
~ Asked on 2013-08-26 16:25:32
If you're coding in an ASP.NET MVC Controller, use
using Microsoft.AspNet.Identity; ... User.Identity.GetUserId();
Worth mentioning that
User.Identity.Name will work without adding the above mentioned
using statement. But
GetUserId() won't be present without it.
If you're in a class other than a Controller, use
In the default template of MVC 5, user ID is a GUID stored as a string.
No best practice yet, but found some valuable info on extending the user profile:
~ Answered on 2013-08-26 19:15:44
Try something like:
var store = new UserStore<ApplicationUser>(new ApplicationDbContext()); var userManager = new UserManager<ApplicationUser>(store); ApplicationUser user = userManager.FindByNameAsync(User.Identity.Name).Result;
Works with RTM.
~ Answered on 2013-11-06 13:09:23