Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: How To Check If An Email Address Is Valid


Message #1 by "ANDREW" <amigo21@p...> on Fri, 2 Feb 2001 17:30:34 -0000
Hi,



   May I know how we can use ASP+ to check if an email address keyed in by

a user does exits?



   Thank you and best regards.





Andrew

Message #2 by "FENG LIU" <qiqiliu@h...> on Fri, 02 Feb 2001 19:24:12
You can write your customerized validation control code

,and in the code just connect to database to check if this person do

exist and return true or false



  Daniel





----Original Message Follows----

From: "ANDREW" <amigo21@p...>

Reply-To: "ASP+" <aspx@p...>

To: "ASP+" <aspx@p...>

Subject: [aspx] How To Check If An Email Address Is Valid

Date: Fri, 2 Feb 2001 17:30:34 -0000



Hi,



    May I know how we can use ASP+ to check if an email address keyed in by

a user does exits?



    Thank you and best regards.





Andrew

Message #3 by John Pirkey <mailjohnny101@y...> on Fri, 2 Feb 2001 11:33:25 -0800 (PST)
there are ways to ensure that it's in a correct format, but asp.net doesn't do

dynamic lookup on the address itself (as far as i know).  there are third party

solutions that do actually do a DNS check on the address, but i can't think of their

names right now.  someone here should know - if not jump over to www.codeguru.com/vb

and search their message board for it.  i've seen a few answers over there for this

exact question.



as for the formatting - here's the validator code i use to check:



	<asp:TextBox id="txtEmail" size="30" runat="server" />

	<asp:RequiredFieldValidator runat="server"

		id="validEmailRequired" ControlToValidate="txtEmail"

		errormessage="Please enter an email address."

		display="Dynamic" />

	<asp:RegularExpressionValidator runat="server"

		id="validEmailRegExp" ControlToValidate="txtEmail"

		ValidationExpression="^[\w-]+@[\w-]+\.(com|net|org|edu|mil)$"

		errormessage="Please enter a valid email address."

		Display="Dynamic" />



courtesy of "A Preview of ASP+" by, none other than, Wrox press.



hope this helps,



john



--- ANDREW <amigo21@p...> wrote:

> Hi,

> 

>    May I know how we can use ASP+ to check if an email address keyed in by

> a user does exits?

> 

>    Thank you and best regards.

> 

> 

> Andrew

> 



John Pirkey 

MCSD 

John@S... 

http://www.stlvbug.org

Message #4 by "FENG LIU" <qiqiliu@h...> on Fri, 02 Feb 2001 21:04:50
  Hi:

  some code  i copy as below,in the page,you can customerized the validation 

control do what you what between the <SCRIPT language="" 

runat="server"></SCRIPT>:



  Daniel





<tr>

  <td align="right" colspan="5">Email:</td>

  <td colspan="1">

   <input type="text" id="txtEmail" size="16" runat="server" />

  </td>

  <td>

   <asp:CustomValidator id="validtxtEmail" runat="server"

    controlToValidate="txtEmail"

    onServerValidationFunction="ValidateEmail"

    errorMessage="The Email you have entered is not exist"

    display="dynamic">

    *

   </asp:CustomValidator>

  </td>

</tr>

<script language="VB" runat="server">

Function ValidateEmail(ByVal objSource As Object, ByVal strEmai As String) 

As Boolean



    //set up the connection

    //check the email exist



    If 'something  Then

      ValidateEmail= True   '

    Else

      ValidateEmail= False  '

    End If



End Function



</script>

















----Original Message Follows----

From: John Pirkey <mailjohnny101@y...>

Reply-To: "ASP+" <aspx@p...>

To: "ASP+" <aspx@p...>

Subject: [aspx] Re: How To Check If An Email Address Is Valid

Date: Fri, 2 Feb 2001 11:33:25 -0800 (PST)



there are ways to ensure that it's in a correct format, but asp.net doesn't 

do

dynamic lookup on the address itself (as far as i know).  there are third 

party

solutions that do actually do a DNS check on the address, but i can't think 

of their

names right now.  someone here should know - if not jump over to 

www.codeguru.com/vb

and search their message board for it.  i've seen a few answers over there 

for this

exact question.



as for the formatting - here's the validator code i use to check:



	<asp:TextBox id="txtEmail" size="30" runat="server" />

	<asp:RequiredFieldValidator runat="server"

		id="validEmailRequired" ControlToValidate="txtEmail"

		errormessage="Please enter an email address."

		display="Dynamic" />

	<asp:RegularExpressionValidator runat="server"

		id="validEmailRegExp" ControlToValidate="txtEmail"

		ValidationExpression="^[\w-]+@[\w-]+\.(com|net|org|edu|mil)$"

		errormessage="Please enter a valid email address."

		Display="Dynamic" />



courtesy of "A Preview of ASP+" by, none other than, Wrox press.



hope this helps,



john



--- ANDREW <amigo21@p...> wrote:

 > Hi,

 >

 >    May I know how we can use ASP+ to check if an email address keyed in 

by

 > a user does exits?

 >

 >    Thank you and best regards.

 >

 >

 > Andrew

 >



John Pirkey

MCSD

John@S...

http://www.stlvbug.org


  Return to Index