Copied to clipboard

Flag this post as spam?

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


  • Matt Todd 9 posts 29 karma points
    Sep 17, 2012 @ 23:04
    Matt Todd
    0

    MVC Sub Application, Profiles empty

    I have a sub application set up in the Umbraco folder working OK. I inherit the Membership Role nd Profile settings from the root Umbraco web.config.

    If I use razor I can get the User Profile Data no problem, but if I try to get the authenticated users profile in the MVC sub application the profile properties are empty.

    I have tried to get them using profle.GetProperty("firstName").Value; same result empty string. I can see all of the Membership properties, but no values.

    If someone could give me some idea as to why my sub app can not retrieve the property values I would be very grateful.

    web.config

    <profile defaultProvider="UmbracoMemberProfileProvider" enabled="true">
            <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="surName" allowAnonymous="false" provider="UmbracoMemberProfileProvider" type="System.String"/>
                <add name="dateOfBirth" allowAnonymous="false" provider="UmbracoMemberProfileProvider" type="System.DateTime"/>
    
    
            </properties>
        </profile>  
    if (HttpContext.User.Identity.IsAuthenticated)
    {
        MembershipUser user = Membership.GetUser(User.Identity.Name);
        var member = new Member((int)user.ProviderUserKey);
    
        var fname = profile["firstName"];
        var sur = profile["surName"];
        var dob = profile["dateOfBirth"];
    }
Please Sign in or register to post replies

Write your reply to:

Draft