I finally found an answer, take a look at:
http://weblogs.asp.net/scottgu/archi...18/427754.aspx
I'm not sure where the class ProfileCommon comes from, because I have been
unable to get Intellisense to list it, but when I use ProfileBase instead
everything works fine. Here is a copy of my code just so you can see what I
did:
Private Sub cuwRegister_CreatedUser(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cuwRegister.CreatedUser
Dim tempprofile As ProfileBase =
ProfileBase.Create(Me.cuwRegister.UserName, True)
Dim bday As String =
CType(Me.cuwRegister.CreateUserStep.ContentTemplat eContainer.FindControl("txtBirthday"),
TextBox).Text
Dim loc As String =
CType(Me.cuwRegister.CreateUserStep.ContentTemplat eContainer.FindControl("ddlLangOfChoice"),
DropDownList).SelectedValue
Dim site As String =
CType(Me.cuwRegister.CreateUserStep.ContentTemplat eContainer.FindControl("txtWebsite"),
TextBox).Text
If Not String.IsNullOrEmpty(bday) Then
tempprofile.SetPropertyValue("Birthday", CDate(bday))
If Not String.IsNullOrEmpty(loc) Then
tempprofile.SetPropertyValue("LanguageOfChoice", loc)
If Not String.IsNullOrEmpty(site) Then
tempprofile.SetPropertyValue("PersonalWebsite", site)
tempprofile.Save()
End Sub
Hopefully this will save you some of the frustration that I had, good luck!
--
Nathan Sokalski
http://www.nathansokalski.com/
"Paul Shapiro" <> wrote in message
news:...
>I tried setting profile properties in the CreateUserWizard.CreatedUser
>event, but I got the same error about an anonymous user. I thought from the
>documentation that both the user and the profile would already exist:
> "Use the CreatedUser event to set Web site values, such as
> personalization values, before the user is logged on to the site for the
> first time."
>
> Maybe the user exists, but it doesn't seem the Profile exists yet. I moved
> the code to a page event, where it now checks to see if the Profile has
> been initialized. I would also like to find a more appropriate event for
> initial Profile setup.
>
> "miher" <> wrote in message
> news:...
>> Hi,
>> I think You have to wait with setting Profile values until the user gets
>> created, and she gets logged in.
>> A suitable event can be the ContinueButtonClick event of the wizard, what
>> is fired if the Continue button is clicked on the second(finish) page of
>> a default wizard.
>> In the handler of this event You should be able to set Profile values.
>>
>> Hope You find this useful.
>> -Zsolt
>>
>> "Nathan Sokalski" <> az alábbiakat írta a következő
>> üzenetben news:...
>>> I am working with ASP.NET Membership, and want to assign values to the
>>> Profile properties when a user registers using the CreateUserWizard. I
>>> have the LoginCreatedUser property of my CreateUserWizard set to True,
>>> but when I use the HttpContext.Current.Profile.SetPropertyValue method
>>> in the CreatedUser event, it tells me I cannot set this for anonymous
>>> users. Where and how should I set any Profile properties I want to set
>>> during registration? Thanks.
>>> --
>>> Nathan Sokalski
>>>
>>> http://www.nathansokalski.com/
>