cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Hiding web page from Authenticate Users and allowing Anonymous Users to access it

I have a requirement to allow access to a web page to Anonymous Users but once any users logged-in then restrict access to that page or logged-in users. I tried with Web Role but it didn't work

 

Any solutions ?

Thanks

 

Regards 

MO

7 REPLIES 7
Highlighted
Helper V
Helper V

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Hi @MO4 

 

Create a Web Page Access Control Rules and add the Web roles to those rules to hide for Authenticated users but show for Anonymous Users.

 

Please link and Accept it as a Solution if it helps you.

Thanks,

Amit

Highlighted
Regular Visitor

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

I tried the given solution. But its hiding the page from anonymous users also. It don't work. 

Thanks for reply. 😉

Highlighted
Super User II
Super User II

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Hi @MO4 ,

 

The solution proposed by @AmitSah  should work. Another way to achieve this is if you create a web template for your page by yourself in liquid. Then you can easily have a condition like below to show content depending if user is logged in or not.

{% if user %}
// CONTENT FOR LOGGED IN USER
{% else %}
// CONTENT FOR ANON USERS
{% endif %}

 

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.
Highlighted
Regular Visitor

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Hi @OOlashyn thanks for reply 

 

i want to hide button from navbar once any users logged-in the button should disappear

 

button.PNG

Highlighted
Super User II
Super User II

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Hi @MO4 ,

 

Usually, when you do it vice-verse ie restrict access to a web page by specific role with web page access control rules it will automatically remove the link from the header because of the access permissions. However, with the anonymous user, I would suggest modifying Header web template with liquid to see if a user is logged in and if the page is the one you need to hide and just skip it's rendering. 

 

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.
Highlighted
Super User II
Super User II

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Web Page Control Access work only for authenticated type Web Roles as far as I know

there are a few options to achieve your need:

 

  • you can create two different Web Link Sets, one representing the authenticated, and other the anonymous, and define Web Links for each.. then go to your Header Web Template find the line that calls the Web Link Set (the web link set is usually called Default or Primary Navigation) and add the validation mentioned by @OOlashyn, so if you can set different Web Link Set according to the user sign-in state
    • only problem here is that you would end up with two web link sets to maintain.. every new link in the header you have to add twice
  • other option would be adding a custom attribute to your Web Link entity, something like Hide if user Signed In.. and make changes in your Header Web Template adding the validation when rendering the Web Link itself

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Highlighted
Frequent Visitor

Re: Hiding web page from Authenticate Users and allowing Anonymous Users to access it

Thanks this worked for my needs

&   thanks @OliverRodrigues

 

for anyone trying to get this to work here's my example:
of course add your own Weblink Sets instead of ("User+Guest weblink sets") in the {% assign primary_nav=}:

 

 </div>
        <div id="navbar" class="navbar-collapse collapse">
        {% if user %}
        {% assign primary_nav = weblinks["User Weblink Set"] %}
        {% else %}
        {% assign primary_nav = weblinks["Guest Weblink Set"] %}
        {% endif %}

            {% if primary_nav %}
----------------​

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (6,292)