471,595 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

Create Profile. Need advice ...

Hello,

I have a profile with multiple profile properties in my Web.Config:

<add allowAnonymous="false" name="Contact" type="Contact"
serializeAs="Binary"/>
<add allowAnonymous="false" name="Options" type="Options"
serializeAs="Binary"/>

Where each profile property is class, as follows:

<Serializable()_
Public Class Contact
Inherits ProfileBase

' City
Public Property City() As String
Get
Return CType(Me("City"), String)
End Get
Set(ByVal value As String)
Me("City") = value
End Set
End Property ' City
...

End Class

I am creating a new profile to a user which I just created as follows:

Dim myContact As Contact = CType(ProfileBase.Create(username), Contact)
With myContact
.City = tbCity.Text
...
End With
contact.Save()

My question is:

Do I need to repeat this code to all my profile properties or is there
a better way to do this?

I have been Goggling for information on how to create a new profile for
a user which have been just created where there are various properties
and all them are custom classes.

Any advice would be great.

Thanks,

Miguel

Jan 16 '07 #1
1 1286
If you are making individual classes that store in profile, you will have to
work each one separately and add to profile. You can get around repeating
this in multiple locations, by setting up a class that holds the
save/retrieve profile information, but you will still have to have the code
for each class you are serializing into the profile.

Hope I answered the question you were asking. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

********************************************
Think outside the box!
********************************************
"shapper" <md*****@gmail.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
Hello,

I have a profile with multiple profile properties in my Web.Config:

<add allowAnonymous="false" name="Contact" type="Contact"
serializeAs="Binary"/>
<add allowAnonymous="false" name="Options" type="Options"
serializeAs="Binary"/>

Where each profile property is class, as follows:

<Serializable()_
Public Class Contact
Inherits ProfileBase

' City
Public Property City() As String
Get
Return CType(Me("City"), String)
End Get
Set(ByVal value As String)
Me("City") = value
End Set
End Property ' City
...

End Class

I am creating a new profile to a user which I just created as follows:

Dim myContact As Contact = CType(ProfileBase.Create(username), Contact)
With myContact
.City = tbCity.Text
...
End With
contact.Save()

My question is:

Do I need to repeat this code to all my profile properties or is there
a better way to do this?

I have been Goggling for information on how to create a new profile for
a user which have been just created where there are various properties
and all them are custom classes.

Any advice would be great.

Thanks,

Miguel
Jan 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jeff | last post: by
2 posts views Thread by Darius | last post: by
reply views Thread by shapper | last post: by
2 posts views Thread by Nick | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.