开发者

Set connectionstring for Membership Service via code

开发者 https://www.devze.com 2022-12-18 13:37 出处:网络
I have an ASP.NET web project and a membership provider configured via my web.config. Its fully working so no problem there.

I have an ASP.NET web project and a membership provider configured via my web.config. Its fully working so no problem there.

We have an older system with a lot of users and I would therefor like to create a class library that can create users in this ASP.NET project but since its a class library it cannot have its own app.config-file.

is it possible to set all this information via code somehow?

<membership defaultProvider="ShidMembershipProvider"> <providers> <clear/> <add name="ShidMembershipProvider" type="SundaHus.AspNet.Membership.ShidMembershipProvider" connectionStringName="ShidConnectionString" enablePasswordRetr开发者_StackOverflowieval="true" enablePasswordReset="true" requiersQuestionAndAnswer="true" applicationName="ECB3-development" minRequiredPasswordLength="5"/> </providers> </membership>


You have a custom membership provider it looks like? This connects to your own custom database? You should be able to just point to that database for your code. Or, if you just inherit the functionality from the base class, you can also try overriding the Initialize method, look for the connection string, and change the value to something else.

0

精彩评论

暂无评论...
验证码 换一张
取 消