摘要:下一个话题我们来看 ASP.NET 2.0 中新增的 Profile 功能。这和我们要谈的 BuildProvider 有什么关系么? .NET Framework SDK 的文档中有这样一段话,引起了我的兴趣。位于 System.Web.Profile.ProfileBase 类的首页上: 在启动启用了用户配置文件的应用程序时,ASP.NET 会创建一个类型为 ProfileCommon 的新类,该类从 ProfileBase 类继承。强类型访问器被添加到 profile 配置节中为每个属性定义的 ProfileCommon 类中。ProfileCommon 类的强类型访问器调用 ProfileBase 基类的 GetPropertyValue 和 SetPropertyValue 方法,分别用于配置文件属性值的检索和设置。ProfileCommon 类的一个实例被设置为 ASP.NET 应用程序的 Profile 属性的值。 为了启用 Profile 机制,我们需要在 web.config 中进行必要的配置。比如: <xml version="1.0"?> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <connectionStrings> <add name="TestDB" connectionString="........" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <profile defaultProvider="TestProfileSqlProvider"> <providers> <clear /> <add name="TestProfileSqlProvider" ......[阅读全文]