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

Online

Expensive women but women viagra not work for the side grease Oh and if.

Gravatar

Cialis

Viagra, four for and one for Levitra, said spokeswoman Susan Cruzan.

Gravatar

Jerry

best weight loss supplements
weight loss injections
natural weight loss supplements
diet pill
new weight loss medication

Gravatar

Analisa

diet pills
weight loss medications
weight loss pill
weight loss pill
appetite suppressant

Gravatar

Net

Your book there is for a generic cover, left, to return, they rely on more expensive.

Gravatar

GeraldEpiva

[url=http://www.balkesder.org/fonts/confuse.asp?air=96]buy hygetropin online uk[/url]
No matter if you love garden, food preparation, movie star gossip, your puppies or science, it is possible to talk about your understanding and get insight with a specific topic by beginning a blog. You may devote as much time as you'd like, making blogging convenient. Recall the recommendations in this post to make the most of your blogging practical experience!Seeking To Stop Smoking? These Ideas May Help!
[url=http://www.hakankarman.com/images/cache.php?id=89-Hgh-Apotheke-Preis,Jintropin-Gensci-China,Jintropin-Wiki/]Hgh Apotheke Preis[/url]
Be well prepared for the long haul. Significant and profitable investors think about stock's long term alternatives within both bull and bear market segments. Perseverance is an definite have to if you are intending so that you can refrain from the impulse to aspect with shares ahead of time. Should you anxiety-market a inventory plus it rises better, you're only likely to be sorry.
[url=http://www.seafrontmarbella.com/Scripts/book.php?fgd=279.html]buy growth hormone injections uk[/url]
If you are suffering from back pain, use treatments that help radiate warmth in your nerves and muscle tissues. The heat from the cream assists reduce soreness and relax the anxiety of your muscles. It could take a few days of therapy prior to deciding to enjoy the healing qualities in the cream. Make sure to keep raising and shifting as low as possible when suffering from back problems.
[url=http://www.ovvk.ru/banners/get.asp?url=354-Used-Lr3-Uk-Buy-Ansomone-Online-Hgh-Fragment-176-191-Benefits/]Used Lr3 Uk[/url]

Gravatar

KennethLoalt

red site [url=https://ccfullzshop.com/]online cc shop[/url]

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