Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

WindowsMembershipProvider, First name and Last name empty

Vote:
 
Hello,

is there a way to get extended user info in the situation where we are using WindowsMembershipProvider

When I check users in Episerver Admin mode only the following columns are visible:

    Name    Provider    E-mail address    Description    Approved    Locked out

There are no First name, Last name, Company and other columns available for windows users. Trying to access

EPiServer.Personalization.EPiServerProfile.Current.FirstName
// or
EPiServer.Personalization.EPiServerProfile.Current.GetPropertyValue("FirstName")


Gives no result, obviously accessing the property which is not filled. Is there a way to fetch First and Last names in this situation?
#19367
Apr 08, 2008 18:36
Vote:
 

Your web.config has by default SqlProfile as default profile provider. This is of type System.Web.Profile.SqlProfileProvider and the only profile provider shipped with ASP .NET 2.0.

Therefore, accessing FirstName, LastName etc through the EPiServerProfile will not return a value. What you're looking for is a ProfileProvider for Active Directory.  This is not part of EPiServer, neither shipped with ASP .NET 2.0, so you have to do some research (google is your best friend) in order to see if anybody has written a similar provider. See also:
http://msdn2.microsoft.com/en-us/library/aa478953.aspx

#19379
Apr 09, 2008 13:06
Vote:
 

Super, this works! Thanx

Now I still have to figure out how to get values for

EPiServerProfile.Current.DisplayName
EPiServerProfile.Current.FirstName
EPiServerProfile.Current.LastName

Is it possible to get those fields hotwired to AD membership provider and thus avoid using DirectoryEntry and DirectorySearcher classes every time those values are needed?

#19484
Edited, Apr 14, 2008 16:20
Vote:
 

Hi Milos!

No, you would have to build such a profileprovider yourself. The standard AD membership provider simply dont fetch attributes that doesnt exist on the default MembershipUser-class (which doesnt for example have a FirstName-property)

If you create your own AD membership/profile-providers you could channel their respectively needed attributes into one single AD-request thus saving some server roundtrips.

Regards,
Johan Olofsson

#19518
Apr 15, 2008 9:39
Vote:
 

Thanx Johan. That one is clear.

Just one additional question. When such provider is created, does it end with mapping retrieved data to EpiServerProfile.Current? I would like to get full picture of that bridging provider to EpiserverProfile, if it's done that way.

#19521
Apr 15, 2008 10:46
Vote:
 

Starting with EPiServerCMS 5 SP1 there is the option to have the profile all declared within the web.config (i.e. the dependency on profile to inherit from EPiServerProfileBase is removed), and by doing so, you can specify multiple profile providers that each takes care of parts of the total profile.

You can for example implement an ADProfileProvider that handles just the FirstName and LastName properties and leave all other properties handled by the SqlProfileProvider. 

When creating your own profileprovider you implement GetPropertyValues() and SetPropertyValues(), which will be called with a collection of properties that are mapped to "your" provider. These methods are called by the framework, so you dont have to do any mapping to the helperclass EPiServerProfile yourself.

/johan

#19536
Apr 15, 2008 15:41
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.