Last post May 25, 2011 04:26 PM by gambler59
Aug 22, 2006 12:47 PM|rkohler56|LINK
I would like to be able to use the stored procedure 'aspnet_Membership_CreateUser' directly through T-SQL code (instead of going through .Net wrappers) because I need to automate the creation of hundreds of users.
aspnet_Membership_CreateUser has among others the following parameters: @Password, @PasswordSalt, @PasswordAnswer.
I assume that the @Password and @PasswordAnswer have to be encrypted using the @PasswordSalt
I have been unable to find documentation that explains
1. how to create the passwordsalt or where to retrieve it from
2. how to hash/encrypt the password and the security answer.
Is there another SP that does that?
Any help would be greatly appreciated.
Aug 22, 2006 02:25 PM|Xanderno|LINK
Aug 22, 2006 03:26 PM|texx|LINK
Yeah, Xandero has it. Just use the Membership class's CreatUser to automate this adding of users.
Membership.CreateUser has several overrides so you can put in exactly how much info you need. Just be mindfull of any restrictions you need you'll want to place into your Membership provider so any broken rules will be caught, and the user won't be created.
Oct 23, 2006 02:30 PM|kazantia|LINK
can anyone tell me or give me a hint how to use the membership class?
i have to import about 2000 users to the datase
and i don't have any clue how to strat it with the code!
thnx in advance
Oct 23, 2006 02:54 PM|texx|LINK
I like to start with Microsoft's code and examples from MSDN2.
I would just write some code to get the users and passwords, and then use the Membership class's CreateUser cmd for each record from the other user store.
Also, do a search on Membership Provider and it will give you a nice listing of all of the options the Membership Provider has.
Hope this helps.
Jun 15, 2007 01:58 AM|lamakui|LINK
Hi, i think this post will help.
user friendly password
Apr 28, 2008 11:31 AM|rjbdetroit|LINK
Xanderno - How would use the class with a DataGrid? Seems you need an Insert SQL command to do that. Not sure how you would use the DataGrid's Insert features with the membership class. Can you give some direction?
Aug 19, 2008 12:49 PMfirstname.lastname@example.org|LINK
Create the two functions.
The stored procedure is pretty self explanitory.
SQL Server 2005 does not provide specific functions for Base64 encoding / decoding,
but you can create them easily enough by leveraging the XML functionality.
/****** Object: StoredProcedure [dbo].[p_Create_ASP_User] Script Date: 08/18/2008 13:08:28 ******/
Nov 12, 2008 04:34 PM|scsbike|LINK
What do we do if we want
SET @PasswordFormat = 2
for encrypted passwords (Verse: 1 = Hashed like you have)
I need to get the passwords back out for password changes later (and not have the user enter their password. (our users are managed by an admin)
where did you find references to do:
Sep 20, 2010 04:13 PM|manrippo|LINK
What is "@ClearTextPassword" here? I can't find the definition.
Sep 20, 2010 04:39 PM|markallan|LINK
The @ClearTextPassword is the password you are setting. If you want the password to be "unicorn" then @ClearTextPassword = "unicorn". Once the user record is created, the password is one way encrypted so you can never decrypt it to "unicorn" again.
Hope that helps
May 25, 2011 04:26 PM|gambler59|LINK
This post was fab all the way , I managed to get it all working using SQL express 2008 but to work on SQL 2005 server just failed miserably!!! . I have a feeling its all to do with the encode 64 decode 64 part. Does anyone have a solution for SQL 2005
, Im quite happy to use passwordformat 0 (as it an internal site) any ideas how to bypass the hash alltogether if there is no suitable sql 2005 solution.