What a Web? Is there a way to disable ASP.NET subscription provider by using config?
Currently it is a connection string and a sqlMembershipProvider to the Web. Stored in config where i do not want to
Thanks
You usually use the provider after calling your default constructor Call it and call it get started However, using System.Web.Security.Membership is impossible, without web.config, because membership The class is hard-wired in the configuration file. When using the membership category, it will instantify the configurable types in the configuration file.
As I said, when you do not want to configure it in the configuration file, you can create it in code. It will be a good view, especially when you have your IoC framework (you < Code> membership mask can be viewed as the implementation of ICO for the type received from MembershipProvider ). Here is an example to create a SqlMembershipProvider :
var Configuration = New NameValueCollection (); Configuration Add ("name", "SqlProvider"); Configuration Add ("connectionStringName", "SqlServices"); Configuration.Add ("applicationName", "MyApplication"); Configuration.Add ("enablePasswordRetrieval", "false"); Configuration.Add ("enablePasswordReset", "true"); Configuration Add ("requirement question and answer", "true"); Configuration. Add ("Required UIIEEEEEL", "False"); Configuration Add ("password format", "hz"); Configuration. Add ("Maximum Unauthorized Password Search", "5"); Configuration Add ("passwordAttemptWindow", "10"); Var Provider = New SqlMembershipProvider (); the provider. Start ("SqlProvider", Configuration); // and store it here in a fixed field or register it with your // favorite IoC container container.RegisterSingle & LT; MembershipProvider & gt; (the provider); Good luck.
Comments
Post a Comment