Insert SqlMembershipProvider User using SQL To manually create an aspnet_Users/aspnet_Membership record in SQL instead of going through .NET, use the following script: (procs are part of the database installation) * replace the user and application name with your own * * to get other passwords/answers/salts/format, just create a user using .NET and look at the result, update the sql accordingly * -- CREATE A DEFAULT USER declare @defaultUserId nvarchar(20); set @defaultUserId = 'admin'; DECLARE @currentDateTime datetime; SET @currentDateTime = getdate(); declare @p12 uniqueidentifier set @p12=newId(); exec dbo.aspnet_Membership_CreateUser @ApplicationName=N'ApplicationName',@UserName=@defaultUserId, @Password=N'ir26ALT+7u+dxLo/ALhcvDUzQGM=', @PasswordSalt=N'zXO/BsMue40s8pBBjYx/tA==', @Email=N'',@PasswordQuestion=NULL,@PasswordAnswer=NULL, @IsApproved=1,@UniqueEmail=0,@PasswordFormat=1, @CurrentTimeUtc=@currentDateTime,@UserId=@p12 output select @p12 exec dbo.aspnet_Profile_SetProperties @ApplicationName=N'ApplicationName', @UserName=@defaultUserId, @PropertyNames=N'FirstName:S:0:5:Credentials:S:5:0:Description:S:5:0:LastName:S:5:5:', @PropertyValuesString=N'AdminAdmin',@PropertyValuesBinary=0x,@IsUserAnonymous=0, @CurrentTimeUtc=@currentDateTime
Created By: amos 9/30/2009 11:40:57 AM Updated: 9/30/2009 3:41:35 PM
|
|