Hi,
Here it is:
---------------
System.ArgumentNullException was unhandled by user code
Message=Value cannot be null.
Parameter name: value
Source=mscorlib
ParamName=value
StackTrace:
at System.Collections.CollectionBase.OnValidate(Object value)
at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
at EPiServer.Common.Cache.CacheableCollectionBase`2.Add(TItem item)
at EPiServer.Templates.RelatePlus.CommunityModules.CommunitySecurityModule.DefaultSecurity_CreatedUser(ISecurityHandler sender, ICreateUserEventArgs args)
at EPiServer.Common.Security.UserCreateEventHandler.Invoke(ISecurityHandler sender, ICreateUserEventArgs args)
at EPiServer.Common.Security.Data.SecurityFactory.<>c__DisplayClass1.<AddUser>b__0()
at EPiServer.Common.Data.DatabaseHandler.RunInTransaction(TransactionCode transactionCode)
at EPiServer.Common.Security.Data.SecurityFactory.AddUser(User user)
at EPiServer.Common.Security.SecurityHandler.AddUser(IUser user)
at MyProj.Templates.Units.ForumControls.Register.<>c__DisplayClass2.<AddUser>b__0() in C:\Projects\MyProj\Templates\Units\ForumControls\Register.ascx.cs:line 89
at EPiServer.Common.Data.DatabaseHandler.RunInTransaction(TransactionCode transactionCode)
at MyProj.Templates.Units.ForumControls.Register.AddUser() in C:\Projects\MyProj\Templates\Units\ForumControls\Register.ascx.cs:line 74
at MyProj.Templates.Units.ForumControls.Register.Button1_Click(Object sender, EventArgs e) in C:\Projects\\MyProj\Templates\Units\ForumControls\Register.ascx.cs:line 33
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
--------------------
Same thing actually happens when I try to create a new user from edit-mode in community tab.
It happens in edit mode too because it occurs in an event handler that always runs when a user is created. Looking at the code makes me suspect that the application setting CommunityMembersGroupName isn't set to the name of an existing group.
Hi Magnus and thanks for the quick answer.
I'm quite new to EPiServer, can you explain a bit more regarding the CommunityMembersGroupNam? Is it about some settings in a config file or some configuration I need to set in edit/admin mode?
There's an application setting class (or whatever they're called) in the Relate templates, EPiServer.Templates.RelatePlus.Properties.Settings in the default install I think. It contains that setting among others. Those application settings files have default values that are compiled, but read from a section in web.config (the node has the same name as the class).
In the default install the setting is "CommunityMembers" and such a group also exists. But if you removed or renamed the group, changed the setting or changed the Settings class and removed the setting you'll have a mismatch here.
You can of course also change the event handler (CommunitySecurityModule.DefaultSecurity_CreatedUser) so it doesn't try to add every user to this group if you don't want that, but remember that the rest of that (giant) class is full of event handlers that set the access rights for that group.
I see, thank you very much for the information. I will dig into this a bit more.
That solved my problem! the group "CommunityMembers" was missing and everything went fine after I created this group in community admin.
Once again, thanks!
Environment:
Issue:
Parameter name: value"
This happens when I try to add user or try geta guid.
----------------------------------------------------------------------------------------------------------------------------
IUser newUser = CommunitySystem.CurrentContext.DefaultSecurity.GetUserByUserName(EmailBox.Text.Trim(',')) as IUser;
if (newUser == null)
{
DatabaseHandler.Instance.RunInTransaction(delegate
{
newUser = (IUser)CommunitySystem.CurrentContext.DefaultSecurity.NewUser;
newUser.UserName = UserNameBox.Text.Trim(',');
newUser.EMail = EmailBox.Text.Trim(',');
newUser.Password = PasswordBox.Text.Trim(',');
newUser.GivenName = FirstNameBox.Text.Trim(',');
newUser.SurName = LastNameBox.Text.Trim(',');
newUser.Alias = String.Format("{0} {1}", newUser.GivenName, newUser.SurName);
newUser.Culture = System.Globalization.CultureInfo.CurrentUICulture;
newUser.BirthDate = new DateTime(2008, 3, 9, 16, 5, 7, 123);
activationGuid = (Guid)CommunitySystem.CurrentContext.DefaultSecurity.AddUserToActivate(newUser); // Error!******
//newUser = (IUser)CommunitySystem.CurrentContext.DefaultSecurity.AddUser(newUser); // Error!*******
});
}