(1). Overview and functions Two methods are used to verify the email format, Asp.net verification control and manual writing. Code Verification. It uses the simple factory and appropriate product design mode, code reconstruction technology, to verify the validity of custom email addresses, and complete the following functions:
Question 1 1 . Email Format: User@server.domain. For example : King.Cheng@hotmail.com or King.Cheng@hotmail.com.cn or King.Cheng@hotmail.com.cn.c.d 2 . Email Only one address is allowed. @ Symbol. 3 . Username Section A) Enter a username. B) It can only start with a number or letter C) Can contain" . "" - "" _ "" ~ The other symbols are invalid. D) Cannot start with a special symbol 4 . Domain Name Section A) The domain name can only contain numbers or letters and cannot contain special characters. B) Enter a domain name or server 5 . Pass DNS Can access this email server, instead WWW Server. For example, Hotmail . Com The email server can access, Hotmail . Com Of HTTP Service But not necessarily the mail server.
Question 2 Rebuild with regular expression Question1 , The above 5 No need to implement .
(2). Answer Download the code and open the solution: Validateemail. sln
Question 1: Engineering : Validateemail answers to this question
Question 2: Engineering : Validateemail_refactor: answer to this question [reconstruction project]
The reconstructed class structure is as follows:
(3) Download Sample Code
Http://files.cnblogs.com/ChengKing/ManuValidateEmail.rar