Thursday, February 4, 2010

ASP.NET's Membership, Roles, and Profile

Pretty good introduction to ASP.NET's Membership, Roles, and Profile:
http://www.4guysfromrolla.com/articles/121405-1.aspx

Get UserId:
MembershipUser myObject = Membership.GetUser();
string UserID = myObject.ProviderUserKey.ToString();

Code to update membership property:
MembershipUser u = Membership.GetUser("member");
u.IsApproved = false;
Membership.UpdateUser(u);
Note that must use UpdateUser() method otherwise it won't update.

No comments:

Blog Archive

Followers