Regular Expression for Email Address validation in C#

The task at hand is to validate the Textbox in asp.net for a valid email address.

We can attach a RegularExpressionValidator to the text box with the following regular expression:

<asp:RegularExpressionValidator ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" ID="rxpEmail" runat="server"
ErrorMessage="Email Address is not valid" Text="*" Display="Static" ControlToValidate="txtEmail"></asp:RegularExpressionValidator>

UPDATES
Well i searched the net for the standards of a valid email id and i came across with a wonderful article at

I Knew How To Validate An Email Address Until I Read The RFC

It gives a an idea of what an exact RFC standard for the email id is.

I believe that we should follow validations which are quite obvious to the users and allow only standard email addresses.

kick it on DotNetKicks.com

Shout it

pimp it

Twitter from ASP.NET Application

twitter
This post will throw a light on how we can update our status on Twitter from an asp.net application.

The task is pretty simple as we have libraries already available on the net.

I will be using twitterizer dll to perform the task.

The following are the steps to be followed:

  1. Download the twitterizer dll from here.
  2. Add the reference to the dll in your asp.net web application.
  3. Write the code. For example
    Twitter t = new Twitter(UserName, Password);
    t.Status.Update(UpdateString);

Following are the methods and the capabilities provided by these methods which are present in the library:

User Methods

  1. Followers
  2. Friends
  3. Follow User

Status Methods

  1. User Timeline
  2. Public Timeline
  3. Friends Timeline
  4. Show
  5. Update
  6. Destroy
  7. Replies

Direct Messages

  1. Sent To User
  2. Sent From User
  3. New Direct Message

References: Twitteriser Home Page

kick it on DotNetKicks.com

Shout it

pimp it

Adding Blogs to an asp.net application

BlogEngine.NET

This is an opensource project and makes us very simple for us to add blogging engine to an asp.net application.

BlogEngine.NET may be the simplest and most light weight ASP.NET blog at the moment, but still full featured. Here are some of the features:

– Multi-author support
– Pingbacks and trackbacks
– Event based for plug-in writers
– Theming directly in master pages and user controls
– Gravatar and coComments implemented
– Live preview on commenting
– Comment moderation
– BlogML import/export
– Extension model
– Code syntax highlighting
– Mono support
– Full editing and creation of pages that are not posts
– Extended search capabilities
– Tag cloud
– Self updating blogroll
– Runs entirely on XML or SQL Server. Your choice.

Home page of BlogEngine.NET

kick it on DotNetKicks.com