PersonalizationProvider.DetermineInitialScope Method

Definition

Determines whether the initial personalization scope should be Shared or User scope.

public:
 virtual System::Web::UI::WebControls::WebParts::PersonalizationScope DetermineInitialScope(System::Web::UI::WebControls::WebParts::WebPartManager ^ webPartManager, System::Web::UI::WebControls::WebParts::PersonalizationState ^ loadedState);
public virtual System.Web.UI.WebControls.WebParts.PersonalizationScope DetermineInitialScope (System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, System.Web.UI.WebControls.WebParts.PersonalizationState loadedState);
abstract member DetermineInitialScope : System.Web.UI.WebControls.WebParts.WebPartManager * System.Web.UI.WebControls.WebParts.PersonalizationState -> System.Web.UI.WebControls.WebParts.PersonalizationScope
override this.DetermineInitialScope : System.Web.UI.WebControls.WebParts.WebPartManager * System.Web.UI.WebControls.WebParts.PersonalizationState -> System.Web.UI.WebControls.WebParts.PersonalizationScope
Public Overridable Function DetermineInitialScope (webPartManager As WebPartManager, loadedState As PersonalizationState) As PersonalizationScope

Parameters

webPartManager
WebPartManager

The WebPartManager that manages the personalization information.

loadedState
PersonalizationState

The personalization state information.

Returns

A PersonalizationScope indicating whether the current personalization scope is User or Shared.

Exceptions

webPartManager is null.

The page associated with webPartManager is null.

Remarks

This method determines whether the current scope should be Shared or User, given a reference to a WebPartManager control and the personalization state information that has already been loaded from earlier in the personalization life cycle. This information is used by a WebPartPersonalization instance for subsequent personalization-related tasks.

The following rules are used to determine personalization scope:

  • Scope is assumed initially to be User.

  • If the currently executing user account is not authenticated, the scope is set to Shared.

  • If the currently executing user account is authenticated, additional processing occurs in order of precedence:

    • If the page is in postback mode, the page request contains scope information from a previous rendering of the page. If that scope information indicates that Shared scope was used, then the scope evaluates to Shared.

    • If the currently executing page had control transferred to it from another page (for example, if the transfer of control occurred due to calling the Transfer method; note that this specific check does not occur for cross-page posting), and if the previously executing page had a WebPartManager instance, the scope is set to the value of the Personalization.Scope property from the previous WebPartManager instance.

    • If the previous criteria are not met, then the scope evaluates to the value of the InitialScope property for the current WebPartManager control.

After the previous evaluations have been made, and if the scope evaluates to Shared scope, the following processing occurs:

  • If the currently executing user account has the EnterSharedScopeUserCapability capability, the scope remains set to Shared.

  • If the currently executing user account does not have the EnterSharedScopeUserCapability capability, then the scope is reset to User.

  • If the result of all previous scope evaluations is Shared, this result is stored as a hidden field on the currently executing page. This is the mechanism whereby a page can replay the scope evaluation during subsequent postbacks.

Applies to