Skip to main content

Sitecore Explore Mode - PageModelHelper

This post provides some basic notes on the properties and methods of Sitecore Explore mode's  PageModelHelper class. It's part of an ongoing series taking a deep dive in to this feature.

Namespace: Sitecore.ExperienceExplorer.Business.Helpers
Assembly: Sitecore.ExperienceExplorer.Business
All information is written with reference to Sitecore 8.0 (rev. 141212)

In general, the PageModelHelper class provides information designed to help Explore mode determine how it should process the current page. This is based on the current state of the Experience Editor, the origin of the request, and the user's permissions.

IsEditMode

This property checks the sc_mode query string key in the current URL. If the key is present and the value is "edit", then the property returns true. Otherwise it returns false.


IsPreviewMode

This property checks the sc_mode query string key specified in the  the in the current URL. If the key is present and the value is "preview", then property returns true. Otherwise it returns false.


IsDebugMode

This property checks the sc_debug query string key specified in the  the in the current URL. If the key is present and the value is "1", then property returns true. Otherwise it returns false.


IsExperienceMode

This property checks that the following criteria are met:
  • The ExperienceModePipeline.Enabled configuration setting is set to true.
  • The enableExperienceExplorer attribute of the context site defintion is set to true.

If either of these criteria are not met, then the property returns false, otherwise it performs the following additional checks:
  • HttpContext.Current.Items contains the key "IsExperienceMode".
  • The sc_mode query string key is present in the current URL, and the value is "edit".
  • The context page mode is normal.

If all of these criteria are met, then the property returns the value of  IsExperienceMode in HttpContext.Current.Item. Otherwise, it performs the following checks:
  • The user is authenticated
  • The user has permission to access the Experience Explorer (see HasPermission property).
  • A query string or cookie is present with the key ExperienceExplorer.AddOnQueryStringKey and the value "1".
  • The request in not internal (see IsInternalRequest property).

If all of these criteria are met then the property returns true. Otherwise it return false.


IsInternalRequest

This property checks the contents of Context.Request.FilePath and returns true if any the following criteria are met:
  • The filepath contains "/sitecore modules/web/experienceexplorer/"
  • The filepath contains "/sitecore".
  • The filepath contains "/layouts/system".

If none of these criteria are met then the property returns false.


HasPermission

Returns true if  any of the following criteria are met:
  • The current user is an administrator.
  • The current user is a member of the role sitecore\Experience Explorer.
  • The current username is sitecore\eevirtualuser.

If none of these criteria are met then the property returns false.


ResetAnalyticsCookie()

This method calls ResetAnalyticsCookie(Guid guid), supplying a newly generated GUID that is prefixed with "ffff" as the parameter.


ResetAnalyticsCookie(Guid guid)

This method checks that the specified GUID is valid. In the case of the Experience Explorer the a GUID must be prefixed with "ffff" to be considered valid.

After this, the methods runs some logic with an object of type ContactKeyCookie. Strangely this class contains methods and properties with literally no implementation - so obviously nothing else actually happens in this method. I therefore assume that it's intended for use in future versions, or is the remains of some abandoned code.




Comments