PersonalizationProvider.DetermineInitialScope Method (WebPartManager, PersonalizationState)

 

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

Namespace:   System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

public virtual PersonalizationScope DetermineInitialScope(
	WebPartManager webPartManager,
	PersonalizationState loadedState
)

Parameters

webPartManager
Type: System.Web.UI.WebControls.WebParts.WebPartManager

The WebPartManager that manages the personalization information.

loadedState
Type: System.Web.UI.WebControls.WebParts.PersonalizationState

The personalization state information.

Return Value

Type: System.Web.UI.WebControls.WebParts.PersonalizationScope

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

Exception Condition
ArgumentNullException

webPartManager is null.

ArgumentException

The page associated with webPartManager is null.

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.

.NET Framework
Available since 2.0
Return to top
Show: