More in this section

Forums / Developing with Sitefinity / Custom Profile Access

Custom Profile Access

2 posts, 0 answered
  1. Aaron
    Aaron avatar
    24 posts
    Registered:
    15 Feb 2008
    22 Nov 2011
    Link to this post
    We have successful setup our custom Membership and role providers as directed here: http://www.sitefinity.com/blogs/slavoingilizov/posts/11-04-20/using_the_asp_net_sql_membership_provider_in_sitefinity.aspx

    But we can not figure out how to use our custom profile the default profile instead of Sitefnity's profile provider.
    Is this possible? If not how can we reference our provider instead?

    In our web.config the profile is registered.
    <profile inherits="SitefinityWebApp.Code.HTSProfile" defaultProvider="AspNetSqlProfileProvider"  enabled="true">
      <providers >
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="HTSLogin" applicationName="/"  />
      </providers>
    </profile>


    Here is our profile class which inherits the generic .net base class HTSProfile.cs

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.Profile;
        using System.Web.Security;
     
    namespace SitefinityWebApp.Code
        {
            public class HTSProfile : ProfileBase
            {
     
                public static HTSProfile GetUserProfile(string username)
                {
                    return Create(username) as HTSProfile;
                }
                public static HTSProfile GetUserProfile()
                {
                    return Create(Membership.GetUser().UserName) as HTSProfile;
                }
     
                [SettingsAllowAnonymous(false)]
                public string FirstName
                {
                    get { return base["FirstName"] as string; }
                    set { base["FirstName"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string LastName
                {
                    get { return base["LastName"] as string; }
                    set { base["LastName"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string StreetAddress
                {
                    get { return base["StreetAddress"] as string; }
                    set { base["StreetAddress"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string City
                {
                    get { return base["City"] as string; }
                    set { base["City"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string State
                {
                    get { return base["State"] as string; }
                    set { base["State"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string Zip
                {
                    get { return base["Zip"] as string; }
                    set { base["Zip"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string Telephone
                {
                    get { return base["Telephone"] as string; }
                    set { base["Telephone"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string Ssn
                {
                    get { return base["Ssn"] as string; }
                    set { base["Ssn"] = value; }
                }
     
                [SettingsAllowAnonymous(false)]
                public string DateOfBirth
                {
                    get { return base["DateOfBirth"] as string; }
                    set { base["DateOfBirth"] = value; }
                }
            }
    }
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    24 Nov 2011
    Link to this post
    Hello Aaron,

    Unfortunately we do not have ASP.NET profile provider wrappers. And our profiles implementation kind of overrides the default profile implementation, so basically I recommend you to use our Profiles instead of the built-in ones.

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered