How to get Profile instance out of asp.net page,

The way of getting Profile instance from a page context is Profile.GetProfile(). But how to do this when you need to get it from App_Code for instance. Here is the way:

MembershipUser mUser = Membership.GetUser(UserId);
ProfileCommon prof = (ProfileCommon)System.Web.Profile.ProfileBase.Create(mUser.UserName);

the object "prof" has all profile fields as in a page.

No comments:

Post a Comment