Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have added a custom email field to the member type. I am validating the member email with the custom email field for login. So I need to show a validation message in the Umbraco backend for already existing email while creating a new Umbraco member.
I am trying with the code below but it is not working as expected
private void MemberSaving(IMemberService sender, Umbraco.Core.Events.SaveEventArgs<IMember> e)
Random randomNumber = new Random();
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
foreach (var memberItem in e.SavedEntities)
if (memberItem.ContentType.Alias == "Member")
var Email = memberItem.Email;
var AdditionalEmail = memberItem.GetValue<string>("additionalEmail");
var IsExist = _memberService.GetByEmail(AdditionalEmail);
if ((string.IsNullOrWhiteSpace(Email.ToLower()) == string.IsNullOrWhiteSpace(AdditionalEmail.ToLower())) || IsExist!=null)
e.Cancel = true;
e.Messages.Add(new EventMessage("Invalid email", "You can not add already existing email...", EventMessageType.Success));
Please help to find a solution for this
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted