如何将 Sys.Services.ProfileService 用于非默认配置文件提供程序?
我想编写 javascript 来保存到不是 web.config 中指定的默认提供程序的配置文件提供程序:
<profile defaultProvider="SqlProfileProvider">
<providers>
<clear />
<add name="SQLiteProfileProvider" applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection" type="GalleryServerPro.Data.SQLite.SQLiteProfileProvider" />
<add name="SqlProfileProvider" applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection" 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>
我可以使用此 javascript 保存到默认提供程序:
Sys.Services.ProfileService.properties["ShowMediaObjectMetadata"] = "true";
Sys.Services.ProfileService.save(null, null, null, null);
但是如何保存到名为 SQLiteProfileProvider 的提供程序?
谢谢, Roger Martin
I want to write javascript to save to a profile provider that is NOT the default provider specified in web.config:
<profile defaultProvider="SqlProfileProvider">
<providers>
<clear />
<add name="SQLiteProfileProvider" applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection" type="GalleryServerPro.Data.SQLite.SQLiteProfileProvider" />
<add name="SqlProfileProvider" applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection" 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>
I can save to the default provider with this javascript:
Sys.Services.ProfileService.properties["ShowMediaObjectMetadata"] = "true";
Sys.Services.ProfileService.save(null, null, null, null);
But how can I save to the provider named SQLiteProfileProvider?
Thanks,
Roger Martin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论