Not a perfect solution but you can combine that check with a check if it is in Edit mode instead
Hi,
You certainly can create a visitor group based on whether the user's logged in though it's not one of the out of the box criteria. I've written similar before and it was quite straightforward but, if you don't fancy writing it yourself you might be able to use the role criterion which you can add through nuget:
https://nuget.episerver.com/package/?id=RoleCriterion
Just as a word of warning - I seem to recall that the rolecriterion package had a few quirks when used with identity rather than membership providers but that may just have been our project (it had lots of customisation around the authentication mechanism).
I think you must click on Toggle View Settings icon, then click on View as ... icon. In my test, I have a block that is only visible to anonymous user, in Edit View, logged user cannot see it
But if I choose view as Anonymous user, it's visible to Editor
Hello!
I am trying to implement a feature where a block is invisible if an authenticated user is viewing the site, and visible if it is being viewed by an anonymous visitor.
My first thought was to use visitor groups, because it allows the content author to toggle the view and know how it will look based on each state. However, I do not see that you can use logged in state to control a visitor group unless I am mistaken.
What is the preferred way to handle this use case? Currently I have wrapped my block in a check @if (!User.Identity.IsAuthenticated), but it is not ideal because the content author won't see it.
Thanks for any advice!