views:

226

answers:

1

Hi.

I am attempting to design a custom profile class that allows me to access the aspnet tables in addition to my custom tables (all in the same DB).

I have been following two online examples that describe how to wire up a custom profile class. In this example, I am asked to inherit from ProfileProvider

How To Implement A Custom Profile Provider

And, in this one, I am asked to inherit from ProfileBase:

Writing a custom ASP.NET Profile Class

What is the difference between these two examples and which way is better? Should I be inheriting from ProfileProvider or ProfileBase? What is the difference?

public class UserProfile : ProfileProvider

public class UserProfile : ProfileBase

Thanks.

+1  A: 

The ProfileProvider base class is the provider that creates the object that derives from ProfileBase.

When you specify a custom provider (that is, a type that derives from ProfileProvider), you're writing a class that creates profile objects for a given user. For example, maybe you read the profile data (favorite color, age, location, etc.) from a database, a file on disk, or from a remote web service.

This is useful is you need functionality that is not available in ASP.NET's built in profile provider.

When you specify a custom profile base class (that is, a type that derives from ProfileBase) you're writing a class that represents the profile data itself.

This is useful when you want to have additional functionality on the profile object itself, such as providing additional metadata on the profile properties.

Eilon
Thanks for that. I have sorted it out and it works in so far as I can register an aspnet_Profile. But, the fields seem to be a name/value collection in the "PropertyNames", "PropertyValueStrings" columns. How do I get the fields to populate my own custom table - dbo.Profile? Thanks again.
Code Sherpa
I'm sorry but that's beyond my knowledge of how ASP.NET profile works. Good luck!
Eilon