asp.net - How to access informations of the membership users with MVC4 -
i have website member section. there's admin manage users. want admin sees informations of other users, username , email.
for now, registration page asks users username, password , email following this tutorial. memorises in db find, in userprofile
table. problem access them. knew how mvc3 membership.getallusers().cast<membershipuser>()
, where
specify request.
but, in mvc4, membership.getallusers()
not permitted understand. have tried lot of different ways found on web, none solve problem. best i've found username, found in post :
var model = roles.getusersinrole("statuswaiting").select(membership.getuser).tolist();
where "statuswaiting"
role of users in db. but, (and others same result), have emailid appears in model, empty.
does know how achieve this? i'm still looking haven't found yet.
edit : if there's way achieve i'm mind opened
edit2 : line above, membershipuser fields : comment, creationdate,email,isapproved,..., providername,...,username. strating think table put email @ registration not same 1 i'm trying informations. don't figure out 1 else be
if role "statuswaiting" can roles using:
var model = roles.getusersinrole("statuswaiting"); //note case
if db populated correctly, error query.
edit:
the method signature default role provider is:
public string[] getusersinrole(string rolename)
that's reason username in query. if want more data query db directly, without using role provider. code 1 below should help.
var query = db.usertablename.where(x => x.role == "statuswaiting");
Comments
Post a Comment