Copied to clipboard

Flag this post as spam?

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


  • Mo 34 posts 54 karma points
    Jun 30, 2010 @ 12:43
    Mo
    0

    help: best approach to implement custom asp.net membership?

    Maybe I posted in the wrong place the first time. The original post:

    link

     

    So far, I've:

    1. created a custom sqlprovider
    2. added the .net membership tables to the database
    3. created inital roles and users using asp.net WAT


    I just need some advice on where to go from there.

    I need to have the same functionality that is available when using umbraco membership: changing member passwords, editing member types, adding custom fields to member types etc.

    Which strategy would be better: Modifying the user controls that make up umbraco membership or creating new ones from scratch?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jul 01, 2010 @ 06:07
    Aaron Powell
    0

    If you have inherited from the build-in .NET membership types then you just need to change your web.config to use the appropriate ones. They also have all the scaffolding for doing what you require, either as a MembershipProvider, RoleProvider or ProfileProvider.

  • Mo 34 posts 54 karma points
    Jul 01, 2010 @ 09:54
    Mo
    0

    are you referring to UmbracoMembershipProvider, UmbracoRoleProvider etc. ?

     

    I can't use those as I have additional sites within the same server. I need the same members that are managed under the main umbraco site to be able to use their login details to access those other sites, and I can't use umbraco membership on non-umbraco sites.

  • Mo 34 posts 54 karma points
    Jul 05, 2010 @ 14:52
    Mo
    0

    i am really stumped on this! Anybody can point me to a tutorial for a user control that can edit .net member profiles?

     

    Maybe I can integrate it into the member dashboard

  • Mo 34 posts 54 karma points
    Jul 06, 2010 @ 18:49
    Mo
    0

    according to this post (2008):

    " Managing members through the UI is currently only supported if you use the umbraco members."

    http://forum.umbraco.org/yaf_postst7431_Aspnet-membership-tables.aspx?find=unread

     

    ah.... help?

  • Mo 34 posts 54 karma points
    Jul 06, 2010 @ 19:10
    Mo
    0

    Is there a tutorial on creating a dashboard user control at umbraco.tv? Can't seem to find one...

  • Mo 34 posts 54 karma points
    Jul 06, 2010 @ 19:24
    Mo
    0

    sorry, I was actually only referring to the Edit Member dashboard

  • arviman 71 posts 92 karma points
    Jul 06, 2010 @ 23:24
    arviman
    0

    I'm using a custom asp.net membership provider. The front-end created users appear on the "Members" section although I believe to change your password, you need to set EnablePasswordRetrieval as true in your provider.

     

  • Mo 34 posts 54 karma points
    Jul 07, 2010 @ 08:18
    Mo
    0

    Thanks for the reply,

    I tried that but it didn't work.

    Right now, I can only change the email address on a member, and I can create a new role.

    I can't delete roles, or edit member passwords. Also, no member profile details...

    i'm looking for a way to get the member profile up and running

  • arviman 71 posts 92 karma points
    Jul 07, 2010 @ 08:35
    arviman
    0

    By member profiles, do you mean integration with the umbraco backend? I'm pretty sure that capability's not available..

    Its fairly easy to create your own membership provider with a custom profile and a few admin pages to edit them. If you're asking how to go about this, I can give you a few code samples to get started with using custom profiles, not to mention the tonne of  samples already existing out there.

  • Mo 34 posts 54 karma points
    Jul 07, 2010 @ 12:57
    Mo
    0

    cool! thanks for your offer to help.

     

    I need to have edit profile pages on the frontend for site members, as well as integrate profile editing in the member section of the umbraco backend.

    If you can send me some example code to my email, I'd really appreciate it. my email is mo.arabi at gmail dot com

  • arviman 71 posts 92 karma points
    Jul 08, 2010 @ 03:26
    arviman
    0

    Not sure if I should post it here, as it isnt really specific to umbraco, but here it is.  Create a class in your app_code or in a dll referenced by your website that inherits from ProfileBase.

    namespace Arviman.BLL
    {
    public class AccountProfile : ProfileBase
    {
    static public AccountProfile CurrentUser
    {
    get { return (AccountProfile)
    (ProfileBase.Create(Membership.GetUser().UserName));

    }
    }

    public string FirstName
    {
    get { return ((string)(base["FirstName"])); }
    set { base["FirstName"] = value; Save(); }
    }
    // add other properties here
    }
    }

    Add the following to web.config ( and make sure you add the appropriate connection string and change your namespace)

    <connectionStrings>
    <add name="MyConnectionString"
    connectionString="<enter db connstring>"
    providerName="System.Data.SqlClient"/>
    </connectionStrings
    <profile enabled="true" defaultProvider="SqlProvider" inherits="Arviman.BLL.AccountProfile" automaticSaveEnabled="true">
    <providers>
    <clear />
    <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MyConnectionString" applicationName="AppName" />
    </providers>
    </profile>

    As to how you can use your profile class, here's a sample from my CreatedUser event handler for a CreateUserWizard control.

    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
            {
                CreateUserWizard cuw = (CreateUserWizard)sender;
                try
                {
                    AccountProfile current = (AccountProfile)AccountProfile.Create(cuw.UserName, true);

                    //Set profile properties
                    current.FirstName = ((TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtFirstName")).Text;
    }
    }

    Getting the currently logged in user's profile can be done using AccountProfile.CurrentUser.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft