Hey Demitrij, pretty sure you have to call provider.EncodePassword(string password) first, i dont think the password is encoded when you execute CreateUser() thus it does not get saved to the database. Hope this helps :)
Allright, well this might help, but in my example I am not referencing "provider", and I can see in your example you are referencing it via "provider." and than calling EncodePassword() method on it... could you maybe provide a snippet for that? :)
sorry :) yea that was a bit misleading, what you need to do is on the CreateUser method there is a parameter which i think is an out parameter for success. If you put a string in this paramater and then have a look at it when debugging it will tell you why the user is not being created. Charlie :)
How to create new Member Umbraco 6.0.1
Hello everyone,
I am trying to use Umbaco 6.0.1 rescent releas since there you could finally edit profile and .save() the changes.
So far everything works fine...
Except when I am trying to create new Member in C#.
I am currently using this code here to create it, it seams like it goes through (no exceptions or anything) but the member is not created.
//create new member var newmember = System.Web.Security.Membership.CreateUser(userName, password, email); var profile = ProfileBase.Create(userName); profile["name"] = name; profile["telephone"] = telephone; profile["age"] = age; profile.Save();
Note I do have a Member type in umbraco - type is called: "BasicUser"
Profile works when I am edditing Existing members or if they are added through administration.
I can save and extract information from there.
So my problem here is when I run this code, new Member is not created (I cannot see him among members in administration > members).
Any suggestions?
//Dmitrij
Hey Demitrij, pretty sure you have to call provider.EncodePassword(string password) first, i dont think the password is encoded when you execute CreateUser() thus it does not get saved to the database. Hope this helps :)
Hej Charlie :)
Allright, well this might help, but in my example I am not referencing "provider", and I can see in your example you are referencing it via "provider." and than calling EncodePassword() method on it... could you maybe provide a snippet for that? :)
//Dmitrij
Hi, sorry igone that above :). You simply need to use
Try using this to begin with and see it that works. I can get this to work in Umbraco 4.11.1
Pretty sure this is the problem. Just use Membership member = new Membership.CreateUser(userName, password, email);
....
....
Hope this helps :)
Yea, well it gives some extra space to think :)
But aren't you supposed to use the membership class that I made (class is called "myMember")?
and in your example here you are suggesting to use this:
but that is same as I am using... and it might be me, but I can't figure out where should I use the "provider", or how should I understand this one :)
I am sorry for this confusion, but I hope we can figure this one somehow :)))
Do we have some more suggestions? :(
//Dmitrij
sorry :) yea that was a bit misleading, what you need to do is on the CreateUser method there is a parameter which i think is an out parameter for success. If you put a string in this paramater and then have a look at it when debugging it will tell you why the user is not being created. Charlie :)
is working on a reply...