Good morning,
I need to create a webservice, it must be located out of dnn installation (I can´t use Iweb). I would like to use dnn classes.
In one webmethod, I have to create users. In bin folder, I've added all dnn dll's
[WebMethod]
public bool Alta_Colegiado(string dni, string password, string idColegiado, string email, string display_name,string telefono)
{
int PortalID_const = 0;
int RolID_const=1;
try
{
UserInfo objUserDnn = new UserInfo();
//objUserDnn.Profile.InitialiseProfile(PortalID_const);
objUserDnn.PortalID = PortalID_const;
objUserDnn.Membership.Username = dni;
objUserDnn.FirstName = idColegiado;
objUserDnn.Membership.Password = decodificar(password);
objUserDnn.Membership.Email = email;
objUserDnn.Membership.Approved = true;
objUserDnn.Username = dni;
objUserDnn.Profile.PreferredLocale = "es-ES";
objUserDnn.DisplayName = display_name;
objUserDnn.Email = email;
objUserDnn.AffiliateID = 0;
objUserDnn.Profile.Telephone=telefono;
UserCreateStatus objUserCreateStatus= UserController.CreateUser(ref objUserDnn);
if (objUserCreateStatus == UserCreateStatus.Success)
{
RoleController rc = new RoleController();
rc.AddUserRole(PortalID_const,objUserDnn.UserID,RolID_const,DateTime.Parse("31/12/2090"));
return true;
}
else
return false;
}
catch (Exception e)
{
FicheroRegistro fich_reg = (FicheroRegistro)Application["FicheroRegistro"];
lock (fich_reg)
{
fich_reg.Escribir(e.Message.Replace("\r\n", "\r\n\t"));
}
return false;
}
}
using lines:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Security;
using Interesa.Architecture.BCL.Extranet;
using ws.coiina.es.des.Util;
using System.Web.UI;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security.Membership;
using DotNetNuke.Security.Roles;
This line:
UserCreateStatus objUserCreateStatus= UserController.CreateUser(ref objUserDnn);
throw one exception (nullreferenceexception)
Can you help me???
How should the webconfig file be?