Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
SqlPersonalizationProvider Class

Updated: November 2007

Implements a personalization provider that uses Microsoft SQL Server.

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

Visual Basic (Declaration)
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class SqlPersonalizationProvider _
    Inherits PersonalizationProvider
Visual Basic (Usage)
Dim instance As SqlPersonalizationProvider
C#
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class SqlPersonalizationProvider : PersonalizationProvider
Visual C++
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class SqlPersonalizationProvider : public PersonalizationProvider
J#
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal) */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal) */
public class SqlPersonalizationProvider extends PersonalizationProvider
JScript
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.

TopicLocation
How to: Build and Run the Data-bound Web Parts Control ExampleBuilding ASP .NET Web Applications
How to: Build and Run the Data-bound Web Parts Control ExampleBuilding ASP .NET Web Applications
How to: Build and Run the Data-bound Web Parts Control ExampleBuilding ASP .NET Web Applications in Visual Studio
System..::.Object
  System.Configuration.Provider..::.ProviderBase
    System.Web.UI.WebControls.WebParts..::.PersonalizationProvider
      System.Web.UI.WebControls.WebParts..::.SqlPersonalizationProvider
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 Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker