将 ASP.NET 成员资格 web.config 设置移至数据库 这可能吗?
我希望对此能得到富有成效的答案。我应该如何将 web.config 中为 asp.net 成员资格提供的设置移动到数据库中以进行跨应用程序自定义。例如会员信息包括如下
<providers>
<add
name="OdbcProvider"
type="Samples.AspNet.Membership.OdbcMembershipProvider"
connectionStringName="OdbcServices"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
writeExceptionsToEventLog="true" />
</providers>
</membership>
额外的
.NET 2.0
ASP.NET 2.0
相关
I am hoping for fruitful answer to this. How should i move the settings provided in web.config for asp.net membership into a database for cross application customization. For example membership information include below
<providers>
<add
name="OdbcProvider"
type="Samples.AspNet.Membership.OdbcMembershipProvider"
connectionStringName="OdbcServices"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
writeExceptionsToEventLog="true" />
</providers>
</membership>
Extra
.NET 2.0
ASP.NET 2.0
Related
moving asp.net membership specific settings to a separate config file
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,你可以!我们已经成功地做到了这一点。
您可以通过多种方式来完成此操作,一种是将您需要的任何属性注入到提供程序的实例中(此示例假设您正在使用
SqlMembershipProvider
并显示如何注入连接字符串,但是您可以您可以查看OdbcMembershipProvider
的源代码,了解自己在哪里执行此操作):或者,您可以通过创建继承
MembershipProvider
的类来创建自己的提供程序。或者,正如 @Andomar 的链接所建议的,您可以从
MembershipProvider
的任何实现(例如SqlMembershipProvider
等)继承,以获得您想要的内容。多年来我们已经完成了这三项工作,具体取决于需要多少定制。
Yes, you can! We have done this successfully.
You can do it in a few ways, one is to inject whichever properties you need into an instance of the provider (this example assumes you are using
SqlMembershipProvider
and shows how you can inject the connection string, but you can take a look at the source ofOdbcMembershipProvider
to get an idea where to do this yourself):Or, you can create your own provider by creating a class that inherits
MembershipProvider
.Or, as the link from @Andomar suggests, you can inherit from any implementation of
MembershipProvider
(such asSqlMembershipProvider
, amongst others), to get what you want.We have done all three over the years depending on how much customisation was required.