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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -