Exclude URL from PropertyCrieria

Vote:
 

Hi,

How is it done to exclude URLS from a search when using PropertyCriteria. For example I need to exclude pages under a Member area from appearing in a sitemap.

I am using Episerver 8 but we are using PropertyCriteria.

Thanks

Jon

#133675
Sep 08, 2015 15:18
Vote:
 

Hi! Are the pages protected by access rights? Then they should be excluded if you use the FindPagesWithCriteria method and not FindAllPagesWithCriteria. To make sure that the call is made as an anonymous user you can try this code:

IPrincipal oldPrincipal = EPiServer.Security.PrincipalInfo.CurrentPrincipal;
EPiServer.Security.PrincipalInfo.CurrentPrincipal = EPiServer.Security.PrincipalInfo.AnonymousPrincipal;

// Make the call to FindPagesWithCriteria here
...

// Go back to the original principal.
EPiServer.Security.PrincipalInfo.CurrentPrincipal = oldPrincipal;
#133832
Sep 11, 2015 11:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.