SqlPersonalizationProvider Class
Collapse the table of content
Expand the table of content

SqlPersonalizationProvider Class

Note: This class is new in the .NET Framework version 2.0.

Implements a personalization provider that uses Microsoft SQL Server.

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

public class SqlPersonalizationProvider : PersonalizationProvider
public class SqlPersonalizationProvider extends PersonalizationProvider
public class SqlPersonalizationProvider extends PersonalizationProvider

This class defines the required functionality for a personalization provider using Microsoft SQL Server. A personalization provider both loads and stores personalization data on behalf of a WebPartPersonalization instance. This class implements the logic for reading from and writing to computers running SQL Server, and also implements all the abstract methods defined in PersonalizationProvider. For more information on personalization providers, see PersonalizationProvider.

The data design for using Web Parts personalization with SQL Server relies on the existence of two common SQL database tables, and their supporting stored procedures, that are shared for most SQL-based feature implementations. These tables and views are installed and uninstalled using the following scripts:

  • installpagepersonalization.sql – Installs the personalization tables, views, and related stored procedures.

  • uninstallpagepersonalization.sql – Uninstalls the personalization tables, views, and related stored procedures.

It is important to be aware that personalization will fail if your Web application does not run at the default trust level of Medium or higher (you can set custom trust levels in a Web.config file using the <trust level="" /> element). The PersonalizationAdministration and SqlPersonalizationProvider classes both check for a trust level of Low when they are initialized. If you configure your application to run at a trust level of Low, and you use the default SqlPersonalizationProvider provider to manage the personalization data for your application, the first time that the application tries to access personalization data, it will fail because an ASP.NET worker process running in Low trust does not have the permissions necessary to call into the various classes in the System.Data.SqlClient namespace.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2016 Microsoft