SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have content that I only wish to display to anonymous users.

Once the user has logged in, I would like to hide it.

Is "Audience Targeting" the right way to do this, and if so, it seems I can only choose 'All Site Users" as the group to target. Is there a specific group I could create that includes ONLY anonymous users?

share|improve this question
Keep in mind that Audience Targeting only hides/shows content to certain audiences, it doesn't make it inaccessible. With 'URL-hacking' (e.g. changing the id from 2 to 3 in the url) or 'Show all content' the content can be seen. – Dribbel Feb 23 '10 at 8:09
up vote 5 down vote accepted

Possibly the most common approach for dealing with this is to use the LoginView control. In your master page/page layout/whatever, simply wrap the markup/controls you wish to display to authenticated/anonymous users in a LoginView control - this will allow you to easily specify who should see what.

Effectively you don't need to do anything 'SharePoint' here - this all works because SharePoint is built on top of, and knows whether the current user is authenticated or not.

A simplified extract from the MSDN sample at the link above:

<asp:LoginView id="LoginView1" runat="server">
                    Please log in for personalized information.
                    Thanks for logging in 
                    <asp:LoginName id="LoginName1" runat="Server"></asp:LoginName>.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.