我知道我可以通过这样的代码在ASP.NET中获得对默认配置文件的引用:
ProfileBase p = ProfileBase.Create(username);(我知道还有HttpContext.Current.Profile,但这是针对当前用户的,我需要通过用户名获取配置文件。)
上面的代码仅适用于在web.config的defaultProvider属性中定义的默认提供程序:
<profile defaultProvider="SqlProfileProvider">
<providers>
<clear />
<add applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection"
name="SQLiteProfileProvider" type="GalleryServerPro.Data.SQLite.SQLiteProfileProvider" />
<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection"
name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>
<add name="ShowMediaObjectMetadata" defaultValue="false" type="String" allowAnonymous="true" />
<add name="UserAlbumId" defaultValue="0" type="Int32" allowAnonymous="false" />
<add name="EnableUserAlbum" defaultValue="true" type="String" allowAnonymous="false" />
</properties>
</profile>如何获取对非默认提供程序的引用?例如,上面显示的名为SQLiteProfileProvider的提供程序?我让它在角色和成员中工作:
RoleProvider rp = Roles.Providers["SQLiteRoleProvider"];但是Profile对象模型是不同的,我不能理解它。谢谢你的帮助!
罗杰·马丁
Gallery Server Pro
发布于 2010-02-02 20:21:51
在.net框架中使用ProfileManager类
https://stackoverflow.com/questions/1079425
复制相似问题