I am trying to create a new user through an external web service. This service uses aspnet membership provider, the problem is that the service fails and returns this message:
Referencia a objeto no establecida como instancia de un objeto(Object reference not set to an instance of an object).
en umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) en
umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName,
String Email, MemberType mbt, User u) en
umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email,
MemberType mbt, User u) en
umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username,
String password, String email, String passwordQuestion, String passwordAnswer,
Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
en System.Web.Security.Membership.CreateUser(String username, String password,
String email, String passwordQuestion, String passwordAnswer, Boolean
isApproved, Object providerUserKey, MembershipCreateStatus& status) en
UserService.newuser(String strUserName, String strUserPassword, String
strUserQuestion, String strUserAnswer, String strUserEmail)
MembershipCreateStatus status = new MembershipCreateStatus();
try { var member = System.Web.Security.Membership.CreateUser(strUserName, strUserPassword, strUserEmail, strUserQuestion, strUserAnswer, true, out status);
Error creating a new user
Hi,
I am trying to create a new user through an external web service. This service uses aspnet membership provider, the problem is that the service fails and returns this message:
Referencia a objeto no establecida como instancia de un objeto(Object reference not set to an instance of an object). en umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) en umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u) en umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email, MemberType mbt, User u) en umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) en System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) en UserService.newuser(String strUserName, String strUserPassword, String strUserQuestion, String strUserAnswer, String strUserEmail)
Web method:
public string newuser(string strUserName, string strUserPassword,string strUserQuestion, string strUserAnswer, string strUserEmail)
{
string strResultado = string.Empty;
MembershipCreateStatus status = new MembershipCreateStatus();
try
{
var member = System.Web.Security.Membership.CreateUser(strUserName, strUserPassword, strUserEmail, strUserQuestion, strUserAnswer, true, out status);
if (status == MembershipCreateStatus.Success)
{
strResultado = "OK";
}
else
{
strResultado = status.ToString();
}
}
catch (Exception ex)
{
strResultado = ex.Message + ex.StackTrace;
}
finally
{
GC.Collect();
}
return strResultado;
}
I have got the necessary tables in my database, user has written accesses to the database.
Thanks beforehand.
Regards,
Eduardo Macho
Hi Eduardo,
have a look at this post, it might contain your answer or point you in the right direction:
http://our.umbraco.org/forum/developers/api-questions/11466-Dynamically-creating-new-members-in-Umbraco-45
It also contains a link to Aaron's excellent blog(s) on members in Umbraco.
Hope that helps,
Sascha
Hi Sascha,
Thank you for your prompt answer.
Regards,
Eduardo Macho
is working on a reply...