Script to create an ASP.NET Membership provider User

PositiveGuy picture PositiveGuy · Feb 9, 2012 · Viewed 14.4k times · Source

I created a bunch of insert scripts to add a new user to the aspnet_Membership and aspnet_User table. I can't auth, says it can't find my user.

Has anyone tried to create a new membership user via T-SQL inserts? I have to do it this way because our create user code in C#/ASP.NET does not work at the moment.

Answer

Vinicius picture Vinicius · Oct 8, 2013

From MSDN:

declare @now datetime
set @now= GETDATE()
exec aspnet_Membership_CreateUser 'MyAppName','admin1','pass@word1', '','[email protected]','','',1,@now,@now,0,0,null

http://msdn.microsoft.com/en-us/library/gg252020(v=office.14).aspx