views:

164

answers:

1

I've setup two membership providers: my custom provider and the Sitefinity provider. My custom membership provider is set as the default.

I want to use Sitefinity's Profile provider for both sets of users. However, the profile provider only seems to work for the users that I pull out of the Sitefinity membership provider.

After poking around with Reflector a bit, it seems that the Telerik Profile Provider assumes that the username exists in its own DB.

User userByName = this.Application.GetUserByName(userName);
if (userByName != null)
{
// magic happens here...
}

All the magic only happens if it was able to retrieve the user locally. Seems to violate the principles of the providers. Shouldn't I be able to arbitrarily add properties to any user regardless of the membership provider?

(I've also posted this on the Sitefinity forum, but haven't got a response yet. SO has spoiled me. I've come to expect an answer in minutes, not days.)

A: 

If I understand you correctly you want to use the sitefininty provider as a base and attach some additional information to the users profiles.

In general I would advise against trying to mingle with internal sitefininty management. Instead try to attach whatever functionality you want to execute to the standard provider.

What I have done in these situations in the past was creating a Membership Provider Wrapper (In your case a ProfileProviderWrapper) that holds an internal reference to another profile provider, while being a Profile provider itself.

This way you can execute any code you want before/after calling back to the actual underlying provider (or maybe your not calling back at all). For example: Before returning the profile you could attach additional properties to it.

This way you don't break the sitefinity behavior, while still being able to interfere.

ntziolis