Regular Expression to validate ApplicationUser email address in ASP.net MVC5 -


i creating webapp in asp.net mvc5 allow people domain sign up.

from understand easiest way use regular expression. there way use data annotations change model, or have play around view achieve this?

probably bit late suggest follows:

i've have app in need modify of applicationuser properties, trying haven't tested on real life yet, unit tests passing far, useful you.

override email property in applicationuser, , add custom validation annotation:

[validateemaildomain(errormessage = "not valid email domain.")]     public override string email { get; set; } 

validateemaildomain code:

using system.componentmodel.dataannotations; using system.web;  namespace wathever {     public class validateemaildomain: requiredattribute     {         public override bool isvalid(object value)         {             //code         }     } } 

note validateemaildomain inherits requiredattribute become obligatory, if don't want way, validate when it's null.

sorry english :/


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -