开发者

Create Dot Net Nuke user from code

Can someone please tell me if it possible to create a new user in a dotnetnuke application from code? I have a list of users that I wish to be added via a windows service.

I've figured out how to write the t-sql side of things but I need to pass in the encrypted password into the procedure, I think I know how to do this as I have access to the machine key, but in the开发者_运维问答 database there is an extra field called passwordsalt, how do I generate this?


UserController class has static methods:

CreateUser(ByRef objUser As UserInfo) As UserCreateStatus

GeneratePassword() As String

ChangePassword(ByVal user As UserInfo, 
               ByVal oldPassword As String, 
               ByVal newPassword As String) As Boolean

Before calling CreateUser, you'll need to create a UserInfo object and set the properties required for a user, such as the Username. UserController passes the UserInfo to the membership provider, which validates and creates the user. See UserController and AspNetMembershipProvider in the DNN source for more details.


Can someone please tell me if it possible to create a new user in a dotnetnuke application from code?

If it wasn't possible then dotnetnuke itself couldn't create a user. Look at the code for DotNetNuke and see how a user is created.

I've figured out how to write the t-sql side of things but I need to pass in the encrypted password into the procedure, I think I know how to do this as I have access to the machine key, but in the database there is an extra field called passwordsalt, how do I generate this?

Do yourself a favor and do NOT run your own t-sql query use the method that creates a user instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜