Copied to clipboard

Flag this post as spam?

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


  • skiltz 501 posts 701 karma points
    Jul 31, 2010 @ 06:25
    skiltz
    0

    ASP.net Membership + Protecting Pages (Public Access)

    I've created my own membership provider and I want to protect certain pages.  I've implemented by own role provider and can set access using "public access".

    From what I understand when a page is accessed in the front end umbraco.library.hasaccess is called to make sure the user has access.

    In umbraco 4.5 the method looks like

     [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)]
            public static bool HasAccess(int DocumentId, cms.businesslogic.member.Member Member) 
            {
    

     

     I guess my question is how can I protect pages with a customised provider?  In my roleprovider I have set break points on IsUserInRole and GetRolesForUser and neither get hit when accessing a protected page.

    Thanks in advance,
    Matthew

  • skiltz 501 posts 701 karma points
    Jul 31, 2010 @ 08:15
    skiltz
    0

    Ignore me!  Hadn't implemented a couple of provider methods...All good now :)

  • junkard2002 2 posts 22 karma points
    Oct 10, 2010 @ 03:06
    junkard2002
    0

    Hi Skiltz

    I am experiencing exactly the same issue you posted here.

    Could you please post which provider methods you had to implement to get it to work.

    Every liitle help is appreciated.

    Thanks.

  • skiltz 501 posts 701 karma points
    Oct 10, 2010 @ 03:30
    skiltz
    0

    make sure these two methods are implemented in your role provider.

    public override bool IsUserInRole(string username, string roleName)
    public override string[] GetRolesForUser(string username)

  • 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.

Please Sign in or register to post replies