Copied to clipboard

Flag this post as spam?

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


  • Dan 1250 posts 3747 karma points admin c-trib
    Jul 16, 2013 @ 17:37
    Dan
    0

    Only allow logged-in users to download XML file from back-office

    Hi,

    I have an XSLT macro which generates a chunk of XML data.  I've created an alternative template for the website homepage with an appropriate content-type to force this data to be downloaded as an XML file.  It works fine but I'd like to protect this download so that only logged-in users (users not members!) can access it.

    I've tried wrapping a conditional around the XML output in the XSLT file which checks:

    umbraco.library:IsLoggedOn()

    But this always returns false, so I'm assuming this checks members not users?

    Can anyone suggest a way of doing this?

    Thanks

  • Amir Khan 1199 posts 2567 karma points
    Jul 16, 2013 @ 20:25
    Amir Khan
    100

    Not sure in XSLT, but this works in Razor, also here's an article that may help if you're willing to write a custom XSLT extension

    @if(umbraco.BusinessLogic.User.GetCurrent() != null) {
       <h1>hello</h1>
    }
  • 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