Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

PersonalizationAdministration.FindInactiveUserState Method (String, String, DateTime)

Returns a collection of per-user personalization state information for inactive users, based on the specified parameters.

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

public static PersonalizationStateInfoCollection FindInactiveUserState(
	string pathToMatch,
	string usernameToMatch,
	DateTime userInactiveSinceDate


Type: System.String

The path of the page to match.

Type: System.String

The user name to match that has personalization data associated with the page.

Type: System.DateTime

The last date a user's personalization information was accessed.

Return Value

Type: System.Web.UI.WebControls.WebParts.PersonalizationStateInfoCollection
A PersonalizationStateInfoCollection that contains per-user personalization state information.


pathToMatch or usernameToMatch before or after trimming is an empty string ("").

- or -

The provider for a personalization provider defined in configuration is not of the correct type.

- or -

The length of the string of any parameter is greater than 256 characters.


A configuration exception occurred while attempting to create and initialize an instance of one of the configured personalization providers.

- or -

The default personalization provider defined in configuration could not be found.

This method returns a collection of UserPersonalizationStateInfo instances, per-user personalization state information where the pathToMatch parameter value matches the path of a page, usernameToMatch matches a user name that has personalization data associated with that page, and the users are considered inactive. In other words, for each returned record the user's LastActivityDate property value is less than or equal to userInactiveSinceDate. The returned collection contains only UserPersonalizationStateInfo instances.

This method passes query wildcard characters to the underlying data store. Support for wildcard characters is currently dependent on how each provider handles characters such as an asterisk (*), a percent symbol (%), or an underscore (_).

Normally, for SQL-compliant data stores, you can perform a wildcard search on a partial path with the wildcard character appearing at the beginning, the end, or the middle of the search string text in the PathToMatch property. For example, to find all paths that start with "~/vdir", the PathToMatch property would be set to "~/vdir%".

Likewise, a wildcard search on a partial user name could have the wildcard character appear at any point in the text string of the UsernameToMatch property. For example, to find all user names that start with "John", the UsernameToMatch property would look like "John%".

Using the default personalization provider, the PersonalizationStateInfo-derived objects are returned in alphabetical order, and sorted by a combination of path and user name in ascending order. The order of the objects in the collection is determined by the provider.

If userInactiveSinceDate is MaxValue, then the returned values from this method are equivalent to FindUserState.

Both pathToMatch and usernameToMatch can be null. The usernameToMatch parameter can include commas (,) because some data stores, such as those running Microsoft SQL Server, allow commas as wildcard characters.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
© 2015 Microsoft