Hi anyone and everyone, please help with this...
I have an external application that's trying to add a user role to a DNN user and I already followed Philip's advice so here's my code. btw, the RoleController does not contain static methods in my "Install" version of DNN 05.04.01
var container = new DotNetNuke.ComponentModel.SimpleContainer("Test");
DotNetNuke.ComponentModel.ComponentFactory.Container = container;
DotNetNuke.Security.Roles.RoleController rc = new DotNetNuke.Security.Roles.RoleController();
rc.AddUserRole(0, UserID, roleID, DateTime.Now, DotNetNuke.Common.Utilities.Null.NullDate);
I get an exception and so I downloaded the source code to trace it. The very first line of RoleController.AddUserRole is
Dim objUser As UserInfo = UserController.GetUserById(PortalID, UserId)
which does
Return memberProvider.GetUser(portalId, userId)
At this time, memberProvider is Nothing so I get the "Object reference not set to an instance of an object.".
Am I supposed to do anything else to have this working?
Thanks