Last post Jul 05, 2011 06:30 AM by cool_cupid_jny
Jul 05, 2011 02:29 AM|Deyken|LINK
I created a website that carries 3 different Membership Roles for 3 different types of Users. Members, Owners and Organisations. Each type of user has a different UI to work with. At the time of registration or login, I establish and/or assign a User to
a specific Membership Role, based on choice they had to make during registration (saving the latter to my SQL Server DB). Now, I want to retain the currently logged in User's detail information, in this case a Club ID (for a Club Owner), a Member ID for (Members)
and OrgID for Organisations. These criteria need to be carried accross public and restricted pages throughout my website for as long as the current user remains logged in. These criteria will be accessed numerous times, specially when adding new records (Club
Owner ID, Club ID for instance gets added a lot into detail tables through the entire website...).
I tried updating the User.Profile with custom properties I created in the web.config file. I can access these properties in VB.net, but they do not seem to contain the info I set them to at any time. What am I doing wrong? My assignments to these custom
properties look like this:
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
' here we handle this Event, now knowing that this User has been created to the ASPNET Database
' Set the User Registration Role to "Club Owner"
Roles.AddUserToRole(Profile.UserName, "Club Owner")
Profile.ClubOwnerID = sqlInsertClubOwnerData.InsertParameters("CLUB_OWNER_ID").ToString
' Later, we will update the ENTIRE Club Owner Profile
Here is how I intent to access these Profile properties throughout the website for later use:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ProfileUN As String
Dim ProfileClubID As String
ProfileUN = Profile.UserName
ProfileClubID = Profile.CurrentClubID
If ProfileUN = "" Then
lblProfileUN.Text = "Profile UserName did not load"
If ProfileClubID = "" Then
lblProfileClubID.Text = "Profile Club ID did not load"
Am I doing something wrong?
Alternatively, can I perhaps not store these details (of which there will eventually be 44) in a session variable or something? If I need to use a session variable, how do I go about it?
Thank you very much - in advance - for all your assitance!
Jul 05, 2011 02:58 AM|cool_cupid_jny|LINK
Did you add these lines to your web config?
was the value saved in the DB?
Jul 05, 2011 03:31 AM|Deyken|LINK
I now added the additional lines to my web.config. I did not add the values to my DB. Do you mean the ASPNETDB? If so, where do I need to add these to?
Jul 05, 2011 06:30 AM|cool_cupid_jny|LINK
you can customise your DB or If you have implemented asp.net membership then open ur DB you r pointing and check the tables contains
This default provider stores each user's property values in the aspnet_Profile table. The
aspnet_Profile stores each users profile settings in a single row in the table, using a rather inefficient means for storing the property names, data types, and values
refer this link:
http://www.4guysfromrolla.com/articles/101106-1.aspx#postadlink - source code is also available. refer all the parts..
Hope it was useful..