I'm building out a function to allow users to change their email address and if they accidentally put in a whitespace before or after, I need to trim it so the regex doesn't complain. It doesn't seem to work in the place I have it (the string remains exactly the same) but I'm not sure why. This is in my controller:
public ActionResult ChangeEmail(ChangeEmailVM vm)
{
try
{
if (UserManager.EmailAvail(new EmailRequest
{
Email = vm.EmailAddress.Trim()
}))
else//...etc etc
I was thinking I'd possibly need to put .trim() in the getter or setter of the email address but I'm not sure of the proper syntax.