im making an Ajax call to an ashx page where i need to change which group a user is located in. in the ashx file i make a call to the following function:
public static void Valid(int id) { User current = User.GetUserByID(id); if (!current.HasGroup(6143420)) { current.AddToGroup(6143420); current.RemoveFromGroup(6143422); current.Save(); } }
but that unfortunately results in an error however the user actually gets transferred into the right group. [NullReferenceException: Object reference not set to an instance of an object.] Dynamicweb.Modules.UserManagement.User.get_Current(PagePermissionLevels level) +431 Dynamicweb.Modules.UserManagement.User.Save() +201 CvrChecker.Helpers.Valid(Int32 id) +203 CvrChecker.CheckCVR.ProcessRequest(HttpContext context) +2179 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +624 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +269