使用MVC4和SIMPLEMEMBERSHIP的人知道如何通过userId获取用户名?用户未登录,我想删除它,要删除我必须使用
Membership.DeleteUser(string username)
答案 0 :(得分:3)
您可以使用GetUserNameFromId
的{{1}}方法:
SimpleMembershipProvider
确保您引用SimpleMembershipProvider provider = new SimpleMembershipProvider();
string name = provider.GetUserNameFromId(id);
,以便使用WebMatrix.WebData
。
答案 1 :(得分:1)
SimpleMembershipProvider provider = (SimpleMembershipProvider)Membership.Provider;
string username= provider.GetUserNameFromId(12345);
//12345 is the id in SM UserProfile db table