I have an account model in which I use the email address as the username
public class RegisterModel { [Required] [Display(Name = "Email Address")] [DataType(DataType.EmailAddress)] public string UserName { get; set; }
I developed a special class for checking email. But I recently noticed that DataType.EmailAddress . I tried using this data type as shown in the above code to check if I can check the username without my user class, but it fails. So my question is how is this DataType useful in .NET . It seems that I am not doing anything in my Registration form.
Edit: An assistant professor even checks for regular expression matching. For example, Username: SS, ssssss, tttt, etc all sent as valid emails.
Edit: People I have a class for checking email in code behind. I know that a hat is the difficulty of checking emails. I do not ask how to check email. I am just asking about using this data type.
source share