Copied to clipboard

Flag this post as spam?

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


  • Tom Bruce 122 posts 506 karma points
    Sep 03, 2017 @ 14:08
    Tom Bruce
    0

    I Can access protected page even when I’m logged out!!

    Hi, I can still access a protected page even after I have logged out!

    Set-up

    1. Content page - bank-detail.
    2. Document Type – bankDetails.
    3. Template - BankDetails.cshtml

    I have a content page bank-detail.

    I have set this page to be protected.

    This page is protected; you cannot access this page unless you are logged in.

    So if I type the following

    url http://localhost:56973/bank-details/

    I am re-directed to the login page, all good!!

    But if I type the url with the page’s template’s name for the content page i.e. if I type the following url

    http://localhost:56973/ BankDetails /

    The bank-details page is then displayed!!

    i.e Login

    enter image description here

    I then logged out and paste the url into the browser

    http://localhost:56973/BankDetails

    enter image description here

    How do I protect the BankDetails.cshtml

  • Anthony Chudley 50 posts 197 karma points
    Sep 04, 2017 @ 08:03
    Anthony Chudley
    0

    Looking at that I think what you are seeing is the homepage being displayed with the BankDetails template, and not actually your bank-details page, which is protected.

    This is the alt-template functionality, which you can disable if you wish in the umbracoSettings.config.

  • Tom Bruce 122 posts 506 karma points
    Sep 04, 2017 @ 08:56
    Tom Bruce
    0

    Hi Anthony, do you mean in the web config file?

  • Anthony Chudley 50 posts 197 karma points
    Sep 04, 2017 @ 08:59
    Anthony Chudley
    100

    Nope, it's at the bottom of the umbracoSettings.config in the config folder.

    <web.routing trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="true" disableFindContentByIdPath="false" umbracoApplicationUrl=""></web.routing>
    
  • Tom Bruce 122 posts 506 karma points
    Sep 04, 2017 @ 09:20
    Tom Bruce
    0

    Hi Anthony, yep that worked, but its causing me other issues..

    When I login and click on the link for the Bank Details, I am re-directed to the home page.

  • Anthony Chudley 50 posts 197 karma points
    Sep 04, 2017 @ 09:29
    Anthony Chudley
    0

    I'm not entirely sure what's going on there Tom.

    Disabling the alt templates feature should just stop you being able to use those, and shouldn't have an affect on the redirect part. At least not that I know of.

    Is the redirect immediately after the login, or whilst logged in and attempting to visit the protected page?

  • Tom Bruce 122 posts 506 karma points
    Sep 04, 2017 @ 09:35
    Tom Bruce
    0

    Whilst I'm login, I have nav bar with a link to the Bank Details.

    The Bank Details templates renders a partial view.

    This partial view is the issue, it's not protected, how do I protect this view?

  • Anthony Chudley 50 posts 197 karma points
    Sep 04, 2017 @ 09:52
    Anthony Chudley
    0

    Sorry Tom, I'm a bit lost now as to what you are trying to do.

    Why is the nav link going to the template by name, and not the page instead?

    Do you mean, you don't want that link to appear in the Nav if the user doesn't have access to it?

    Or am I barking up the wrong tree and it's something completely different?

  • Tom Bruce 122 posts 506 karma points
    Sep 04, 2017 @ 10:13
    Tom Bruce
    0

    Thanks Anthony, you are spot on!! I need to link to the page, not the template...

    Thanks again :)

  • Anthony Chudley 50 posts 197 karma points
    Sep 04, 2017 @ 10:14
    Anthony Chudley
    1

    Not a problem Tom.

    Glad I could help.

Please Sign in or register to post replies

Write your reply to:

Draft