November Happy Hour will be moved to Thursday December 5th.

Problems using custom Profile Provider

Vote:
 

Hi

I want to use custom profile provider and custom defind properties, but got this error:

Exception Details: System.Configuration.SettingsPropertyNotFoundException: The settings property 'Language' was not found.

Stack Trace:

[SettingsPropertyNotFoundException: The settings property 'Language' was not found.]
System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) +854055
System.Configuration.SettingsBase.get_Item(String propertyName) +89
System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
EPiServer.Personalization.EPiServerProfile.get_Item(String propertyName) +35
EPiServer.Personalization.EPiServerProfile.get_Language() +30
EPiServer.Globalization.SystemLanguage.LanguagePreferenceList(String priorityLanguage) +129
EPiServer.Globalization.SystemLanguage.SetCulture(String priorityLanguage) +35
EPiServer.Globalization.LanguageSelection.SetCulture() +26
EPiServer.PageBase.InitializeCulture() +60
ASP.default_aspx.__BuildControlTree(default_aspx __ctrl) in c:\xxx\Default.aspx:1
ASP.default_aspx.FrameworkInitialize() in c:\xxx\Default.aspx.cs:912307
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +38
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\106bfa9f\3abd8523\App_Web_pkl0z3n3.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Any ideas? Changing EPiServer.Personalization.EPiServerProfile to default Profile class does not help. There is some call to EPiServerProfile and it keeps searching for "Language" property.

#21021
Jun 18, 2008 19:18
Vote:
 

Hi Boyan!

There are some profile properties needed by EPiServer and they would have to be present. One of the nice features with Asp.Net 2.0's profile provider model is that it lets you define more than one provider and declare which property is handled by which provider. This lets you use the default SqlProfileProvider handle all those specific EPiserver properties and let your custom profile provider just handle those properties it cares about.

This is easily done in web.config like so:

<profile enabled="true" defaultProvider="SqlProfileProvider" automaticSaveEnabled="true">
<providers>
<clear />
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="EPiServerDB" applicationName="EPiServerSample" />
<add name="CustomProvider"
type="EPiServer.Personalization.CRMConnector.SalesforceProfileProvider, EPiServer.CRMConnector" />
</providers>
<properties>
<add name="SubscriptionInfo" type="EPiServer.Personalization.SubscriptionInfo, EPiServer" provider="SqlProfileProvider" />
<add name="CustomExplorerTreePanel" type="System.String" provider="SqlProfileProvider" />
<add name="FileManagerFavourites" type="System.Collections.Generic.List`1[System.String]" provider="SqlProfileProvider" />
<add name="EditTreeSettings" type="EPiServer.Personalization.GuiSettings, EPiServer" provider="SqlProfileProvider" />
<add name="ClientToolsActivationKey" type="System.String" provider="SqlProfileProvider" />
<add name="FrameworkName" type="System.String" provider="SqlProfileProvider" />
<add name="Language" type="string" provider="SqlProfileProvider" />


<add name="FirstName" type="string" provider="CustomProvider"  />
<add name="LastName" type="string" provider="CustomProvider" />

</properties>
</profile>

Regards,
Johan Olofsson

#21022
Jun 18, 2008 21:15
Vote:
 

10x Profiles works ok now, but another problem appear after I apply the code you  provide.

Now when I log in as administrator and go in edit  mode this error popup:


System.Configuration.SettingsPropertyNotFoundException: The settings property 'Email' was not found.


Stack Trace:


[SettingsPropertyNotFoundException: The settings property 'Email' was not found.]
System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) +853975
System.Configuration.SettingsBase.get_Item(String propertyName) +89
System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
EPiServer.Personalization.EPiServerProfile.get_Item(String propertyName) +23
EPiServer.Personalization.EPiServerProfile.get_Email() +11
EPiServer.Personalization.EPiServerProfile.get_EmailWithMembershipFallback() +23
EPiServer.UI.Edit.UserMembership.PopulateMembershipFields() +252
EPiServer.UI.Edit.UserMembership.OnLoad(EventArgs e) +928
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

 

EDIT: After adding "Email" in profile properties in Web.config it seems to work now

#21202
Edited, Jun 20, 2008 6:11
* 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.