Groups | Blog | Home
all groups > asp.net > june 2004 >

asp.net : How to do this? EmailMessage.ValidateAddress = false



Miguel Dias Moura
6/22/2004 11:49:12 PM
Hello,

when i uploaded my web site to a server i got this message everytime there
was a form with authentication of an email address:

System.Exception: The FromAddress is not syntactically correct, based upon
the pattern set by EmailMessage.ValidateRegEx: [\w-]+@([\w-]+\.)+[\w-]+ To
turn preliminary email address syntax checking, set
EmailMessage.ValidateAddress = false.

My questions are:
- Why does this happen?
- Where and how to i insert this code to solve this problem:
EmailMessage.ValidateAddress = false

Thanks,
Miguel


Miguel Dias Moura
6/23/2004 11:22:43 AM
I have something like this:

<td>Write your email: >
<asp:RequiredFieldValidator ID="emailRequired" ControlToValidate="from"
ErrorMessage="?" Display="Dynamic" runat="server" CssClass="redNoteTitle"
ToolTip="Write your
email"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
ID="emailRegular" ControlToValidate="from" ErrorMessage="?"
Display="Dynamic" runat="server" ToolTip="Invalid Email"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
CssClass="redNoteTitle"></asp:RegularExpressionValidator>
</td>

The part of the form is:

<td><asp:TextBox Columns="31" CssClass="greyNoteText" ID="from"
runat="server" ToolTip="Write your email" /></td>

This is very strange because in the same web site i have other forms with
email validation.
But in this one i get this error. Even more strange is that the problem only
happens with the email validation not with the required field.

I did that you said but that's not the problem.

Do you see anything wrong here?

Thanks,
Miguel


[quoted text, click to view]
http://www.aspnetemail.com/help/aspnetemail.emailmessage.validateaddress.htm
l
[quoted text, click to view]

Miguel Dias Moura
6/23/2004 11:34:33 AM
But the email i inserted has no dot before the @.

[quoted text, click to view]

Patrice
6/23/2004 11:49:48 AM
This is in your own code ? What is the class you are using ?

It looks like the regular expression doesn't allow a dot before the @ sign
(which is sometimes used and works but not allowed in theory).

Patrice

--

"Miguel Dias Moura" <web001@27NOSPAMlamps.com> a écrit dans le message de
news:ONN2TtKWEHA.2288@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

Patrice
6/23/2004 11:54:56 AM
Found it at :
http://www.aspnetemail.com/help/aspnetemail.emailmessage.validateaddress.html
In this sample they are adding the line just after the object is created.

You could also use another RegExp to take this into account (if you have
something that doesn't match before the @)

Patrice

--

"Patrice" <nobody@nowhere.com> a écrit dans le message de
news:uBPjvdQWEHA.4064@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button