I need to store in a Table messages which are sent using a classical web page CONTACT US.
My question is:
Would be better doing email validation on Business layer or better at Data Base level?
Regarding email validation in BL I would like to know if using asp.net 4 there is some sort of automatic system for validating emails instead of complicated regex or similar.
Regarding validation in DataBase I found out this article, seems quite useful.
http://vyaskn.tripod.com/handling_email_addresses_in_sql_server.htm
I would appreciate your opinions.
Thanks for your support 🙂
I would handle the validation at the business layer. I try to keep as much logic out of the database as possible.
Also, I don’t worry about getting the perfect regex for email addresses. I usually just check that it contains an @ character. I don’t want my validation to disallow some valid email address that I didn’t think of. If I want to be sure that it’s a good address, I’ll send an email to it, and ask them to click a link to validate their email address.