Click here to Skip to main content
14,868,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used (@"[~`!@#$%^&*()-+=|\{}':;.,<>/?]"); this special character to email.
but
i use this ' special character given below exception throw
'System.Data.DataRowView' does not contain a property with the name


i use this < special character given below error throw
A potentially dangerous Request.Form value was detected from the client (ctl00$cphSiteMasterBody$tbxReRegisterRefNo="ghj<fh").


What I have tried:

i used regex regular expression to restrict these two special character but i want this characters also.
Posted
Updated 16-Sep-16 3:48am
v3

Email addresses cannot contain '<' or '>' characters at any time: Email address - Wikipedia, the free encyclopedia[^]
Even then, the rules are different for the Local and Domain parts of the address "local@domain"
It clearly says that the domain part can only contain:
uppercase and lowercase Latin letters A to Z and a to z;
digits 0 to 9, provided that top-level domain names are not all-numeric;
hyphen -, provided that it is not the first or last character.
No other special characters are valid.
The local part is more flexible:
uppercase and lowercase Latin letters A to Z and a to z;
digits 0 to 9;
special characters !#$%&'*+-/=?^_`{|}~;
dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (e.g. John..Doe@example.com is not allowed but "John..Doe"@example.com is allowed);
space and "(),:;<>@[\] characters are allowed with restrictions (they are only allowed inside a quoted string, as described in the paragraph below, and in addition, a backslash or double-quote must be preceded by a backslash);
comments are allowed with parentheses at either end of the local-part; e.g. john.smith(comment)@example.com and (comment)john.smith@example.com are both equivalent to john.smith@example.com.

If you are talking about the message body, then generally speaking '<' and '>' will delimit HTML formatting data which is normally permitted - but any other use of such characters must replace them with &lt; and &gt; respectively in order to show them as < and > when the user reads the mail.
   
Comments
Raja Ganapathy 16-Sep-16 7:49am
   
if i used rj'gmail.com throw the above exception
Afzaal Ahmad Zeeshan 16-Sep-16 15:24pm
   
Why would you want to use single qoute in your email address? Keep it alphanumeric only. Period.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900