Best Approach for Membership / Profile Information

J

jdp

I've created a custom login control with values that are not used in
the Membership table. I created these other fields through the
<profile> tag in the web config. I'm able to get a new member created
my calling membership.create user and get the other fields saved by
creating an instance of ProfileBase, calling
SetPropertyValue("property",value) mulitple times for each property,
and finally calling the Save method. My first question is: is this the
correct approach or is there a better way of creating members and
saving the corresponding data?

Secondly, my site utilizes a master/detail scheme and when the user
logs in, I want to display their name on my master page. I created a
label on the master page and in it's Page_PreRender event, I assign the
text property the Profile.FirstName and Profile.LastName. So far, so
good. All of my detail pages inherit from a 'base' page and I have
logic in the Page_Load event to check the User.Identity.Name and if
found, display the LoginStatus control. However, since Profile is not
available here, this explains why I placed the logic in the master
page. Is this the correct approach? Is there a better way?

Any feedback is greatly appreciated!

Thanks in advance.
 
C

Cowboy \(Gregory A. Beamer\)

jdp said:
I've created a custom login control with values that are not used in
the Membership table. I created these other fields through the
<profile> tag in the web config. I'm able to get a new member created
my calling membership.create user and get the other fields saved by
creating an instance of ProfileBase, calling
SetPropertyValue("property",value) mulitple times for each property,
and finally calling the Save method. My first question is: is this the
correct approach or is there a better way of creating members and
saving the corresponding data?

The "most correct" method would be inherit from the membership classes and
create the extra fields. Then, edit the ASPNET_ database tables with the
info you want. I am currently in the works on this same idea, but do not
have a working example. I will blog when I do:

http://spaces.live.com/gregorybeamer

Otherwise, your method works, even though it requires a few more trips.
Secondly, my site utilizes a master/detail scheme and when the user
logs in, I want to display their name on my master page. I created a
label on the master page and in it's Page_PreRender event, I assign the
text property the Profile.FirstName and Profile.LastName. So far, so
good. All of my detail pages inherit from a 'base' page and I have
logic in the Page_Load event to check the User.Identity.Name and if
found, display the LoginStatus control. However, since Profile is not
available here, this explains why I placed the logic in the master
page. Is this the correct approach? Is there a better way?


I am a bit confused on this one.

Assigning from profile is okay, but I am not sure about the login status
control. Is it not on the master page? If not, why not?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
 
J

jdp

Thanks for the reply.

The controls are indeed on the master page. However, the User.Identity
object does not appear to be available on the masterpage when I try and
check to see if values exist. In my 'base' page, the Profile object
does not exist to get my custom fields. So now I have logic in
master_PreRender to check the profile and logic in base.Page_Load to
check User.Identity
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top