Pregunta

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.

¿Fue útil?

Solución

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
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top