I am trying to find whether the current user is a member of a specific audience and used the below code however it returns "false" though the user belongs to the "testing" audience.
what would be the issue?
We would like to redirect the user based on the audience group.
If Userx is a member of the audience "Testing", he will be redirected to "newWeb" otherwise to "oldWeb".
DelegationControl loads a user control, validation & redirection is taken place on the user control.
Tried the below code however getting the "Access denied" error message while trying to get the audience - "Audience audience = audienceManager.GetAudience("Testing");", have verified and found that the app., pool has full control on the user profile application.
SPUser currentUser = SPControl.GetContextWeb(Context).CurrentUser;
//HttpContext httpCtxt = HttpContext.Current;
//HttpContext.Current = null;
Microsoft.Office.Server.Audience.AudienceManager audienceManager = new Microsoft.Office.Server.Audience.AudienceManager(SPServiceContext.Current);
Audience audience = audienceManager.GetAudience("Testing");
//HttpContext.Current = httpCtxt ;
if ( audience.IsMember(currentUser.LoginName))