Mobile Visitor Group criteria for EPiServer


I'm testing out 'Mobile Visitor Group criteria for EPiServer an It works well on the website.
But in editorview and preview the block is hidden.

Why is editorview behaving different than the website? What can I do to make the editorview behave as expected? Not hide the block while visitorgroup 'desktop' is added.

Oct 18, 2016 15:19

Describing this could be little a bit hard. There are two concpets in EPiServer edit mode called "ImpersonatedVisitorGroupsById" and "ImpersonatedVisitorGroupsByName"This is used by EPiServer in edit mode, to allow editors to preview pages as viewed by particular Visitor Groups. By default in edit mode it ignores the IsMatch, but you have ability to see page in perspective of different "Visitor Group":

I know the  concept it little a bit seems odd but correct in edit mode :) Hope it helped 

Oct 19, 2016 13:20

Just in case this is EPiServer Code:

class EPiServer.Personalization.VisitorGroups.VisitorGroupRole



public bool IsMatch(IPrincipal principal, HttpContextBase httpContext)
string[] strArray1 = httpContext != null ? httpContext.Items[(object) "ImpersonatedVisitorGroupsById"] as string[] : (string[]) null;
if (strArray1 != null)
return ((IEnumerable<string>) strArray1).Contains<string>(this.ID.ToString());
string[] strArray2 = httpContext != null ? httpContext.Items[(object) "ImpersonatedVisitorGroupsByName"] as string[] : (string[]) null;
if (strArray2 != null)
return ((IEnumerable<string>) strArray2).Contains<string>(this.Name);
bool isMatch = this.IsMatchCached(principal, httpContext);
this.AddVisitorGroupStatistics(isMatch, httpContext);
return isMatch;



Oct 19, 2016 13:22

Thank you for clearing that up.

I feel its a little bit anoying that the block dissapears when I set a visitorgroup. Its correct while 'View as this visitorgroup', the block is displayed as expected.

I guess its the best option that the editorview displays all content with no visitorgroups attached.

Oct 20, 2016 16:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.