Search code examples
c#asp.net-membership

C# Programmatically create ASP.NET Membership Schema


I was wondering what would be the best way to install the membership schema on the fly.

Right now the solution I'm thinking of is to somehow run aspnet_regsql.exe with arguments to execute on my db connection.

How can I accomplish this? Is there a better way?


Solution

  • Ok I found a much better way to accomplish this, I still use the MembershipExists() function, but I install it with this statement, which I didn't know of up until a couple of minutes ago.

    SqlServices.Install(database, SqlFeatures.All, connectionString);