Can I get a user profile using the user ID of my membership?

Using Asp.net Members and Profile Providers:

Is it possible to get a user profile using UserID UserID instead of username?

The reason I'm asking is because if I have a UserID and not because of the username, I will have to write the following two lines of code

    Dim MembershipUser As MembershipUser = Membership.GetUser("UserID")
    Dim Profile As Profile = Profile.GetProfile(MembershipUser.UserName)

Instead:

Dim Profile As Profile = Profile.GetProfile ("UserID")

Will it affect performance? Is my design bad? Am I missing something?

Please note: I know that I can get the current user on the system using the following code: HttpContext.Current.User.Identity.Name

+5
source share
1 answer
Guid userId = Membership.GetUser().ProviderUserKey as Guid; 

UserId, . asp.net , .

asp.net , , , Profile.GetProfile(string userName) . GetProfile (userName), , .

+3

All Articles