Westicle
Westicle

Reputation: 87

Accessing the User Class in asp.net Membership from a Class

How can I add a User class as a property to a class I've created?

I'm using the membership classes in my project. First time I've done so. I have a class called Site and I'd like to be able to add a user class as a property to that site.

Ultimately what I'm trying to get to is this point:

Dim dudeThatCreatedSite As String = Site.User.Identity.Name

I'm struggling a little with getting my head around how Membership, MembershipUser and User all work together and I don't see how I can as User as a property.

Upvotes: 1

Views: 82

Answers (1)

afzalulh
afzalulh

Reputation: 7943

Use MembershipUser:

Private myUserValue As MembershipUser
Public Property MyUser() As MembershipUser
    Get
        Return myUserValue
    End Get
    Set(ByVal value As MembershipUser)
        myUserValue = value
    End Set

End Property

Upvotes: 1

Related Questions