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 am trying to do some things in a web part based on the audience that a user is in. This is my first pass at the code, and it works on my dev VM. However on the test machine it fails blocking access to the page with a 403 Forbidden error. The line that it baulks at is the GetAudience line. I suppose that the user does not have permissions to see the audience list or something...

   var site = SPControl.GetContextSite(Context);
   var context = ServerContext.GetContext(site);
   var audienceManager = new AudienceManager(context);
   var audience = audienceManager.GetAudience("Some");
   var user = SPControl.GetContextWeb(Context).CurrentUser;
   if (audience.IsMember(user.LoginName)) {
       // user is in "some" audience, lets do stuff specific to that audience

How SHOULD I be tasting a user to get the audience membership?

share|improve this question
up vote 1 down vote accepted

Try using this:


share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.