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.
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;