Copied to clipboard

Flag this post as spam?

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


  • Dinovo 7 posts 87 karma points
    Aug 10, 2018 @ 14:53
    Dinovo
    0

    Check if page is marked as protected and redirect to login

    In my DocType i have a property by the name of "membersOnly" (true/false).

    When checked, i want to check, if the user is logged in, if not, redirect to login page with a refere.

    But what is the best way to do this - i dont want to have in my Master template. How can i hook into the request pipeline, check if the "membersOnly" field excist, and if it does, and it is checked, and the user is not logged in, redirect the user?

    Any short snippets out there?

  • Paul Tilsed 25 posts 158 karma points c-trib
    Aug 10, 2018 @ 15:04
    Paul Tilsed
    0

    Hi Dinovo,

    Perhaps you would consider using the default page protection provided by Umbraco. Its based on a custom ASP.Net membership provider and offers you a lot of the functionality you need right out of the box.

    https://our.umbraco.com/documentation/Getting-Started/Data/Members/

    https://umbraco.tv/videos/umbraco-v7/content-editor/administrative-content/members/

    Paul

  • Dinovo 7 posts 87 karma points
    Aug 10, 2018 @ 15:20
    Dinovo
    0

    Hi Paul

    Thx for your reply.

    I forgot to mention, that in this case, it is by design, that i am not using the built-in way of doing the same thing in the UI. The reason beeing, that the client, wants a simple way of protecting a simple page, without selecting member groups, login page and error page. It has to be a checkbox-option.

Please Sign in or register to post replies

Write your reply to:

Draft