Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Halldór Hrafn Gíslason 30 posts 50 karma points
    Aug 10, 2010 @ 16:09
    Halldór Hrafn Gíslason
    0

    Empty properties using membership provile provider

    (resubmitted from a previous topic: http://our.umbraco.org/forum/developers/api-questions/11520-Membership-properties,-proper-way-to-do-it)

    Hmm..

    Now that I'm trying to implement this thing, I'm getting a strange error.. or lack there of even..

    My setup: IIS 7.5 / Umb 4.5.1 / .NET 4.0

    My web.config:

    <profile defaultProvider="UmbracoMemberProfileProvider" enabled="true" inherits="MyNamespace.MemberProfile">
    <providers>
    <clear />
    <add name="UmbracoMemberProfileProvider" type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers" />
    </providers>
    <!--
    <properties>
    <clear />
    <add name="firstName" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" />
    <add name="lastName" allowAnonymous ="false" provider="UmbracoMemberProfileProvider" type="System.String" />
    </properties>
    -->

    </profile>

    Note that I have to remove the properties since IIS complains that firstName (and any other property I've defined in Umbraco) has allready been defined.

    On a webpage (profile page) I'm invoking this command on page load:

    FirstName.Text = ((MemberProfile)this.Context.Profile).FirstName;

    Which in turn invokes:

    [SettingsAllowAnonymous(false)]
    public string FirstName
    {
     
    get
     
    {
       
    var o = base.GetPropertyValue("firstName");
       
    if (o == DBNull.Value)
       
    {
         
    return string.Empty;
       
    }
       
    return (string)o;
     
    }
     
    set
     
    {
       
    base.SetPropertyValue("firstName", value);
     
    }
    }

    This will however return an empty string, even though I've set data via umbraco membership section.

    What am I missing here?

    Do I need a tissue? :oP

Please Sign in or register to post replies

Write your reply to:

Draft