Subscribe to the ASP.NET Robot RSS Feed

Email Validation





I searched the internet and I found that one of the common questions is how I can validate users email address from code behind.
So In this tutorial I will show you how you can easily validate email address from code behind Using Regular Expression .
For example add one textbox to your page with id=”txtEmail” ,  add one label with id=”lblResult” and add one button, Add this code to the button onclick event:

 

string pattern = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";

        Match match = Regex.Match(txtEmail.Text.Trim(), pattern, RegexOptions.IgnoreCase);

        if (match.Success)
           lblResult.Text = "Valid";
        else
            lblResult.Text = "Not Valid";

 

Don’t forget to add a namespace to the top of the code behind page:

using System.Text.RegularExpressions;

Add New Comment:

 
 
 
 
 
Gravatar

Felisha

where can i buy zithromax over the counter
buy zithromax
buy zithromax single dose packets
zithromax prices

Gravatar

Marisa

does auto insurance cover death
auto insurance quotes
auto insurance oahu
direct auto insurance

Gravatar

Hildred

cash advance loans
payday loans canada
speedy cash payday loans online
speedy cash payday loans online

Gravatar

Hanna

online payday loans alabama
no fax payday loans
payday loans tucson az

Gravatar

Rachele

buy viagra east london
viagra online
viagra ice cream go sale selfridges

Gravatar

Edwin

payday loans idaho
paydayloan com
fixed loans

Gravatar

Natasha

20 minute payday
no credit personal loans
personal loans clarksville tn

Gravatar

Sommer

http://neosmartsystems.com/index.php/component/k2/itemlist/user/63618 - liability car insurance quotes
auto insurance bakersfield
worst auto insurance

Gravatar

Paypal

DMOZ Categories DMOZ categories for top--store-online.

Gravatar

Jeanne

personal loan poor credit
las vegas loans
where can i get a personal loan with no credit

Gravatar

Elba

terrible credit loans
micro lending
payday loans for bad credit online

Gravatar

Howard

buy cialis in canada online
cialis savings
generic cialis for sale

Gravatar

Dirk

short term cash loans
payday loans
payday loans reviews

Gravatar

Ambrose

where to buy cialis in dubai
cialis
where to buy the cheapest cialis

Gravatar

Soft

Hello!

Gravatar

Cialis

Hello!

Gravatar

Selina

buy viagra dapoxetine
viagra generic
cheap viagra next day delivery uk

Gravatar

Herman

payday loan no teletrack
payday loans online
easy quick loans

Gravatar

Stefanie

where to buy generic levitra
levitra price
levitra discount prices

Gravatar

Shoshana

play casino games for real money online
online casino
usa online casinos for android

Gravatar

Loans

Hello!

Gravatar

Cash

Hello!

Gravatar

Cash

Hello!

Gravatar

Cheap_cialis

Hello!

Gravatar

Viagra

Hello!

Gravatar

Cialis

Hello!

Gravatar

Cialis

Hello!

Gravatar

Cheap_cialis

Hello!

Gravatar

Online_viagra

Hello!

Gravatar

Viagra_buy

Hello!

Gravatar

Online_cialis

Hello!

Gravatar

Order_cialis

Hello!

Gravatar

Fax

Hello!

Gravatar

Cialis|buy

Hello!

Gravatar

Payday

Hello!

Gravatar

Cialis|buy

Hello!

Gravatar

Viagra_cost

Hello!

Gravatar

Online

Hello!

Gravatar

Payday

Hello!

Gravatar

Pharmg328

Hello! gecceac interesting gecceac site! I'm really like it! Very, very gecceac good!

Gravatar

Tablet

Spot lets start off perform on this writeup, I seriously consider this astounding internet site needs much more consideration. Ill apt to become once again to find out to read considerably a lot more, thank you that information.

Gravatar

My

Hello!

Gravatar

Online

Hello!

Gravatar

A

Hello!

Gravatar

Of

Hello!

Gravatar

Business

Hello!

Gravatar

Writing

Hello!

Gravatar

Cialis

Hello!

Gravatar

Viagra

Hello!

Gravatar

To

Hello!

Gravatar

Cialis

Hello!

Gravatar

Cialis

Hello!

Gravatar

To

Hello!

Gravatar

For

Hello!

Gravatar

Side

Hello!

Gravatar

Cialis

Hello!

Gravatar

Of

Hello!

Gravatar

Side

Hello!

Gravatar

Discount

Hello!

Gravatar

Viagra

Hello!

Gravatar

Viagra

Hello!

Gravatar

Cheap

Hello!

Gravatar

Cheap

Hello!

Gravatar

Online

Hello!

Gravatar

Buy_cialis

Hello!

Gravatar

Free

Hello!

Gravatar

Pharmc885

Hello!

Gravatar

Pharmb153

Hello! cialis online pharmacy http://www.cia9online.com/#4.html

Gravatar

Pharmd471

Hello! [url=http://www.cia9online.com/#2.html]cialis online pharmacy[/url]

Gravatar

Smithc581

Good writeup, I am normal visitor of ones blog, maintain up the excellent operate, and It's going to be a regular visitor for a lengthy time. decegefedkeeeedk

Gravatar

RobertDox

[url=https://mrwhite.biz/]cc shop[/url] - mrwhite, cc dumps forum.

Gravatar

JasonMef

изготовление календарей http://wkrolik.com.ua/products/bloknoty

Gravatar

Uemetttindy

Polecam [url=http://bulls.net.pl/]jak inwestować małe kwoty[/url] albo polecam to [url=http://bulls.net.pl/]http://bulls.net.pl/[/url]

Gravatar

WilliamSow

[url=http://shemale-sex.net/tier/toys/shemaleview1.html]shemale sextoys[/url] - shemale video, shemale teen porn.

Gravatar

RonaldDew

[url=http://motaxmoto.ru/]купить детский квадроцикл[/url]

Gravatar

Bradleybot

[url=http://mototexdom.ru/kvadrotsikly-detskie]купить детский квадроцикл[/url]

Gravatar

Catsnamesgoms

Found cat didn't know what to call it. Found here grumpy cat name http://allcatsnames.com/grumpy-cat-names full list of names for cats.




Gravatar

Emmetttindy

Polecam [url=http://bulls.net.pl/]w co inwestować małe kwoty[/url] albo polecam to [url=http://bulls.net.pl/]http://bulls.net.pl/[/url]

Gravatar

I

kjk

Gravatar

Nilesh

ksdflsf

Gravatar

Cc

Goo job

Facebook del.icio.us FriendFeed Digg it Google Buzz Linked in MySpace Reddit Stumbleupon Twitter Technorati