Reputation: 11
I am upgrading a site to MVC 4 and the new simplemembership is killing me.. I am not sure if I am just being stupid but I cannot seem to get UserName from a stored UserId.
In mvc 3 with asp membership I used the following in Razor views where item.CreatedBy is stored Guid:- "@Membership.GetUser(item.CreatedBy).UserName"
What is the equivalent Razor syntax to work with SimpleMembership when itemCreatedBy is now an int.
I am trying to do something like :- @GetUserNameFromId(item.CreatedBy)
All help and pointers gratefully accepted.
many thanks for your time and help
Glyn
Upvotes: 0
Views: 612
Reputation: 194
By default, MVC 4 uses SimpleMembership which is not compatible with the older MembershipProvider. If you haven't modified the Account controller & models, you could try to copy it from a fresh MVC 3 app and replace the existing ones in MVC 4 and see if that helps. Here's a link I found useful from geekswithblogs.net
Upvotes: 2