Developer forum
E-mail notifications
How to create and save users?
Posted on 23/03/2011 17:22:52
Hi,
I'm trying to create and save users by using the API...
var user = new User();
// setting property values here
user.Save();
This works... but not without side effects :/
When a user is saved, that user is set as the current user. How can i avoid that?
Changing the current user when saving a user makes no sense to me.
If you need to change the current user context when users register in frontend, could it be done in a separate method and not in the save method? :)
(19.2.1.3)
BR.
Morten
Replies
Nicolai Høeg Pedersen
Posted on 23/03/2011 17:30:00
That is a bug.
Just fixed it so current user is only updated if the user changed is current user.
TFS6287 - out with next hotfix (19.2.1.7)
Just fixed it so current user is only updated if the user changed is current user.
TFS6287 - out with next hotfix (19.2.1.7)
Posted on 23/03/2011 19:26:33
The UserSync web service also fails when it calls User.Save()
I think that is because you are accessing the session when no session is available.
"...the Context.Session property will be null if EnableSession is not explicitly set to True for a particular Web method."
http://msdn.microsoft.com/en-us/library/aa480509.aspx
I think that is because you are accessing the session when no session is available.
"...the Context.Session property will be null if EnableSession is not explicitly set to True for a particular Web method."
http://msdn.microsoft.com/en-us/library/aa480509.aspx
Aki Ruuskanen
Posted on 07/06/2011 09:01:51
I have this problem in 19.2.2.1.
/Aki
/Aki
Nicolai Høeg Pedersen
Posted on 07/06/2011 09:08:22
Which of the issues?
The webservice or save issue?
The webservice or save issue?
Aki Ruuskanen
Posted on 07/06/2011 10:01:42
Sorry, the issue with creating and saving a new user.
/Aki
/Aki
Nicolai Høeg Pedersen
Posted on 07/06/2011 10:09:48
Hi Aki
So when you save a different user than the one you are logged in with, current user is changed?
Or do you experience another problem?
BR Nicolai
So when you save a different user than the one you are logged in with, current user is changed?
Or do you experience another problem?
BR Nicolai
Aki Ruuskanen
Posted on 07/06/2011 10:24:46
When a user is logged in to frontend and creating a new user with the API the session gets messed up.
Nicolai Høeg Pedersen
Posted on 07/06/2011 10:29:48
Please describe "messed up".
I'm good at a lot of things, but not guessing :-)
I'm good at a lot of things, but not guessing :-)
Aki Ruuskanen
Posted on 07/06/2011 10:38:53
We are building a custom admin for a customer.
In that admin we have a place where they can create new users.
When a user is logged in to the custom admin (using the Extranet/Intranet modul) and try to create a new user (using the API) the logged in users session is lost.
The Save() method of the User object in the Dynamicweb API does something with the logged in users session.
/Aki
In that admin we have a place where they can create new users.
When a user is logged in to the custom admin (using the Extranet/Intranet modul) and try to create a new user (using the API) the logged in users session is lost.
The Save() method of the User object in the Dynamicweb API does something with the logged in users session.
/Aki
Aki Ruuskanen
Posted on 07/06/2011 10:40:28
Basically the same problem that in the first post. But we run version 19.2.2.1.
/Aki
/Aki
Nicolai Høeg Pedersen
Posted on 07/06/2011 11:06:47
Just checked the code and found one more error.
I have made a fix which will be available with next hotfix or service release from us.
I have made a fix which will be available with next hotfix or service release from us.
You must be logged in to post in the forum