Default properties are working fine (such isApproved).
But when I try to create a profile I get always null
public class MemberProfile : ProfileBase
{
public static MemberProfile GetUserProfile(string username)
{
var z = Create(username); // <------ PROFILE COMMON is Correct
return Create(username) as MemberProfile; // Always returns null
}
public static MemberProfile GetUserProfile()
{
return Create(Membership.GetUser().UserName) as MemberProfile;
}
[SettingsAllowAnonymous(false)]
public string AuthGuid
{
get
{
var o = base.GetPropertyValue("auth_guid");
if (o == DBNull.Value)
{
return string.Empty;
}
return (string)o;
}
set
{
base.SetPropertyValue("auth_guid", value);
}
}
[SettingsAllowAnonymous(false)]
public string Name
{
get
{
var o = base.GetPropertyValue("name");
if (o == DBNull.Value)
{
return string.Empty;
}
return (string)o;
}
set
{
base.SetPropertyValue("name", value);
}
}
[SettingsAllowAnonymous(false)]
public string Surname
{
get
{
var o = base.GetPropertyValue("surname");
if (o == DBNull.Value)
{
return string.Empty;
}
return (string)o;
}
set
{
base.SetPropertyValue("surname", value);
}
}
[SettingsAllowAnonymous(false)]
public string Role
{
get
{
var o = base.GetPropertyValue("role");
if (o == DBNull.Value)
{
return string.Empty;
}
return (string)o;
}
set
{
base.SetPropertyValue("role", value);
}
}
[SettingsAllowAnonymous(false)]
public DateTime? LastLogin
{
get
{
var o = base.GetPropertyValue("last_login");
if (o == DBNull.Value)
{
return null;
}
return (DateTime)o;
}
set
{
base.SetPropertyValue("last_login", value);
}
}
[SettingsAllowAnonymous(false)]
public string Comments
{
get
{
var o = base.GetPropertyValue("comments");
if (o == DBNull.Value)
{
return string.Empty;
}
return (string)o;
}
set
{
base.SetPropertyValue("comments", value);
}
}
/*lockedUntil*/
[SettingsAllowAnonymous(false)]
public DateTime LockedUntil
{
get
{
var o = base.GetPropertyValue("lockedUntil");
if (o == DBNull.Value)
{
return new DateTime();
}
return (DateTime)o;
}
set
{
base.SetPropertyValue("lockedUntil", value);
}
}
}
Also, AuthGuid property is not set when ceating the user (with the provider key I suppose).
I don't have a deep understaning of the whole process, so I'm probably missing something...
I'm getting this error at runtime: "this profile property has already been defined"
It seems to be an issue with webapps (I'm using a web application project) which doesn't need the properties to be defined in web.config, but only in the class.
But if I remove the properties from web.config I don't get the error anymore but I don't retrieve the values to (they are always blank)
Still the Member integration
Ok, I'm still working on my member integration.
I think I'm missing somethig.
I have a profile with several custom fields, I've configure it but I can't retrieve it
Here's the web.config
<membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <clear/> <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed"/> <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Default" umbracoApprovePropertyTypeAlias="isApproved" umbracoLockPropertyTypeAlias="isLocked" passwordFormat="Hashed" requiresUniqueEmail="true" umbracoCommentPropertyTypeAlias="comments" umbracoLastLoginPropertyTypeAlias="last_login"/> </providers> </membership> <profile defaultProvider="UmbracoMemberProfileProvider" enabled="true"> <providers> <clear /> <add name="UmbracoMemberProfileProvider" type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers" /> </providers> <properties> <clear /> <add name="Name" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" /> <add name="Surname" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" /> <add name="LockedUntil" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.DateTime" /> <add name="Role" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" /> </properties> </profile>Default properties are working fine (such isApproved).
But when I try to create a profile I get always null
public class MemberProfile : ProfileBase { public static MemberProfile GetUserProfile(string username) { var z = Create(username); // <------ PROFILE COMMON is Correct return Create(username) as MemberProfile; // Always returns null } public static MemberProfile GetUserProfile() { return Create(Membership.GetUser().UserName) as MemberProfile; } [SettingsAllowAnonymous(false)] public string AuthGuid { get { var o = base.GetPropertyValue("auth_guid"); if (o == DBNull.Value) { return string.Empty; } return (string)o; } set { base.SetPropertyValue("auth_guid", value); } } [SettingsAllowAnonymous(false)] public string Name { get { var o = base.GetPropertyValue("name"); if (o == DBNull.Value) { return string.Empty; } return (string)o; } set { base.SetPropertyValue("name", value); } } [SettingsAllowAnonymous(false)] public string Surname { get { var o = base.GetPropertyValue("surname"); if (o == DBNull.Value) { return string.Empty; } return (string)o; } set { base.SetPropertyValue("surname", value); } } [SettingsAllowAnonymous(false)] public string Role { get { var o = base.GetPropertyValue("role"); if (o == DBNull.Value) { return string.Empty; } return (string)o; } set { base.SetPropertyValue("role", value); } } [SettingsAllowAnonymous(false)] public DateTime? LastLogin { get { var o = base.GetPropertyValue("last_login"); if (o == DBNull.Value) { return null; } return (DateTime)o; } set { base.SetPropertyValue("last_login", value); } } [SettingsAllowAnonymous(false)] public string Comments { get { var o = base.GetPropertyValue("comments"); if (o == DBNull.Value) { return string.Empty; } return (string)o; } set { base.SetPropertyValue("comments", value); } } /*lockedUntil*/ [SettingsAllowAnonymous(false)] public DateTime LockedUntil { get { var o = base.GetPropertyValue("lockedUntil"); if (o == DBNull.Value) { return new DateTime(); } return (DateTime)o; } set { base.SetPropertyValue("lockedUntil", value); } } }Also, AuthGuid property is not set when ceating the user (with the provider key I suppose).
I don't have a deep understaning of the whole process, so I'm probably missing something...
thank you
Update: I was missing in the web.config to set
inherits="myclass, myAssembly"
But now I ran into another problem:
I'm getting this error at runtime: "this profile property has already been defined"
It seems to be an issue with webapps (I'm using a web application project) which doesn't need the properties to be defined in web.config, but only in the class.
But if I remove the properties from web.config I don't get the error anymore but I don't retrieve the values to (they are always blank)
Any idea?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.