Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Assigning Profile Properties When A User Registers With CreateUserWizard

Reply
Thread Tools

Assigning Profile Properties When A User Registers With CreateUserWizard

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-12-2009
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/


 
Reply With Quote
 
 
 
 
miher
Guest
Posts: n/a
 
      01-12-2009
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/
>

 
Reply With Quote
 
 
 
 
Paul Shapiro
Guest
Posts: n/a
 
      01-13-2009
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/


 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-13-2009
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/

>



 
Reply With Quote
 
Paul Shapiro
Guest
Posts: n/a
 
      01-15-2009
Thanks very much! That's a big help.

"Nathan Sokalski" <> wrote in message
news:...
>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/

>>

>
>


 
Reply With Quote
 
FlashMerlot
Guest
Posts: n/a
 
      03-11-2009
Outstanding!
Been looking for this solution ...
--
F.V.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning Profile Properties When A User Registers With CreateUserWizard Nathan Sokalski ASP .Net 5 03-11-2009 05:33 PM
<profile><properties> with no Profile class Steven ASP .Net 5 10-24-2008 07:23 PM
Assigning methods to objects, and assigning onreadystatechange to an XMLHttpRequest -- an inconsistency? weston Javascript 1 09-22-2006 09:33 AM
How to Init Profile properties at CreateUserWizard Pedro Mir ASP .Net 1 08-17-2006 10:41 AM
Java Web Start app icons keep going in user profile not All Users profile Brad Java 1 07-19-2005 02:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57