We’re using ASP.Net membership providers (the SQL Server provider), and I want to be able to set up an Admin user account as part of our installer. To do this, I need the ASP.Net membership provider configured so that my installer can use it – but I don’t want to have to set up a config file for the installer.
So is there a way of configuring an ASP.Net membership through code without writing a custom provider?
Ok, following the solution they conjured up here: http://forums.asp.net/p/997608/2209437.aspx
I created a class which, in the parameterless constructor (which you need) just gets the server and port from the command line arguments. Such that I can go “MembershipInitializer.exe “SomeSqlServer\Instance” 51000.
In the app.config of your console app (or windows app)
If you are in need of the role provider bit as well, you probably have to override SqlRoleProvider in much the same way.
If you are creating a program to automatically initialize your membership database to a specific state based but the sql server address and port name aren’t known until someone enters them into a install wizard, this will do the trick..
Does this help?