Xpode.com        Click here to Print this article.

Server side Email validation

Server side Email validation in asp.net

In mostly forms where user enter his email ids. There is need to verify the email format for user because mostly users enter sometime wrong format of email etc. so we are giving the solution for emails validation at server side:

public static bool IsEmail(string Email)
string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
Regex re = new Regex(strRegex);
if (re.IsMatch(Email))
return (true);
return (false);

Call this function when validating the value like:

if (IsEmail(Textbox1.Text))


Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com

Click here to go on website