Search code examples
asp.net-mvcumbracocode-snippets

Show different footer depending if page is protected or not - Umbraco


So, I implemented a protected area on my Website (with umbraco) which has a Login when you want to access a page that normal users don't have access to. I am using the Login Snippet and the Login Status Snippet Macro that umbraco provides.

Like this:

<div class="row">
    <div class="col-xs-12">
         @Umbraco.RenderMacro("MembersLoginStatus")
    </div>
</div>

I am showing it on the footer but right now it is always visible but I only want it to be visible when you are on a page that is protected.

Is there any way to do it?

Thank you in advance!


Solution

  • I simply verified if he is Logged in or not. Using the Umbraco Macro Snippet it is quite easy to find out.

    @if (Umbraco.MemberIsLoggedOn())
    {
      <div class="row">
          <div class="col-xs-12">
               @Umbraco.RenderMacro("MembersLoginStatus")
          </div>
      </div>
    }