S
shapper
Hello,
I read everything I could find and still I get an error ... this is not
making much sense.
The objective: Create a profile for an existing user.
I need to use: Multiple classes with properties and methods which are
added in Web.Config's profile properties.
<add allowAnonymous="false" name="Options" type="Options"
serializeAs="Binary"/>
<add allowAnonymous="false" name="Contact" type="Contact"
serializeAs="Binary"/>
...
My classes are create as follows:
<Serializable()> _
Public Class Options
...
I am creating the new profile as follow:
' Create profile
Dim profile As ProfileCommon = CType(ProfileCommon.Create(username,
True), ProfileCommon)
' Define contact properties
With profile.Contact
.City = tbCity.Text
...
End With
' Define options properties
With profile.Options
.Newsletter = cbNewsletter.Checked
...
End With
' Save user profile
profile.Save()
The error: Type 'System.Web.Profile.ProfileBase' in Assembly
'System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
I checked MSDN2 articles and I can't figure why this is not working.
Thanks,
Miguel
I read everything I could find and still I get an error ... this is not
making much sense.
The objective: Create a profile for an existing user.
I need to use: Multiple classes with properties and methods which are
added in Web.Config's profile properties.
<add allowAnonymous="false" name="Options" type="Options"
serializeAs="Binary"/>
<add allowAnonymous="false" name="Contact" type="Contact"
serializeAs="Binary"/>
...
My classes are create as follows:
<Serializable()> _
Public Class Options
...
I am creating the new profile as follow:
' Create profile
Dim profile As ProfileCommon = CType(ProfileCommon.Create(username,
True), ProfileCommon)
' Define contact properties
With profile.Contact
.City = tbCity.Text
...
End With
' Define options properties
With profile.Options
.Newsletter = cbNewsletter.Checked
...
End With
' Save user profile
profile.Save()
The error: Type 'System.Web.Profile.ProfileBase' in Assembly
'System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
I checked MSDN2 articles and I can't figure why this is not working.
Thanks,
Miguel