November Happy Hour will be moved to Thursday December 5th.

Class FilterForVisitor

A filter that removes any pages that the current user does not have access to or that is not currently published.

Inheritance
System.Object
FilterForVisitor
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Filters
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public static class FilterForVisitor
Remarks

Even though the page is in published status the filter will also remove any pages that does not meet the requirements for start and stop publish dates.

Methods

Filter(PageDataCollection)

Filters the specified pages, removing those that should not be shown to the current user.

Declaration
public static PageDataCollection Filter(PageDataCollection pages)
Parameters
Type Name Description
PageDataCollection pages

The pages that should be filtered.

Returns
Type Description
PageDataCollection

A collection of filtered pages.

Remarks

The PageDataCollection that is sent in to the method is also filtered.

Filter(PageDataCollection, IContentRepository)

Filters the specified pages, removing those that should not be shown to the current user.

Declaration
[Obsolete("Use another overload.")]
public static PageDataCollection Filter(PageDataCollection pages, IContentRepository contentRepository)
Parameters
Type Name Description
PageDataCollection pages

The pages that should be filtered.

IContentRepository contentRepository

The IContentRepository instance to use

Returns
Type Description
PageDataCollection

A collection of filtered pages.

Remarks

The PageDataCollection that is sent in to the method is also filtered.

Examples

The following How To demonstrates one usage of
FilterForVisitor.

Filter(IEnumerable<IContent>)

Filters the specified content items, removing those that should not be shown to the current user.

Declaration
public static IEnumerable<IContent> Filter(IEnumerable<IContent> contentItems)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IContent> contentItems

The content items that should be filtered.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

Content available for the current user.

Filter(IEnumerable<IContent>, IContentRepository)

Filters the specified content items, removing those that should not be shown to the current user.

Declaration
[Obsolete("Use overload that does not take a content repository or FilterContentForVisitor to use a non-static class")]
public static IEnumerable<IContent> Filter(IEnumerable<IContent> contentItems, IContentRepository contentRepository)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IContent> contentItems

The content items that should be filtered.

IContentRepository contentRepository

The IContentRepository instance to use

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

Content available for the current user.