AJAX and WebService implement email verification (without refreshing verification of whether the email address is valid)

Source: Internet
Author: User

First, add a service reference to the project.
--------------------------- Verify that the Email address is correct. aspx ----------------- Copy codeThe Code is as follows: <Head runat = "server">
<Title> </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Asp: ScriptManager ID = "ScriptManager1" runat = "server">
</Asp: ScriptManager>
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
<ContentTemplate>
<Div>
Email <asp: TextBox ID = "txtemail" runat = "server"> </asp: TextBox> <asp: Label ID = "lblinfo"
Runat = "server" Text = ""> </asp: Label>
<Br/>
<Br/>
<Asp: Button ID = "Button1" runat = "server" Text = "call" onclick = "button#click"/>
</Div>
</ContentTemplate>
</Asp: UpdatePanel>
</Form>
</Body>
</Html>

------------------ Verify that the Email address is correct. aspx. cs -----------------------Copy codeThe Code is as follows: protected void button#click (object sender, EventArgs e)
{
WebEmail. ValidateEmailWebService webemail = new WebEmail. ValidateEmailWebService ();
Byte result = webemail. ValidateEmailAddress (txtemail. Text );
If (result = 0)
{
Lblinfo. Text = "Please verify again ";
}
Else if (result = 1)
{
Lblinfo. Text = "the email address is valid ";
}
Else if (result = 2)
{
Lblinfo. Text = "only the domain name is correct ";
}
Else if (result = 3)
{
Lblinfo. Text = "an unknown error ";
}
Else if (result = 4)
{
Lblinfo. Text = "the email server cannot be found ";
}
Else if (result = 5)
{
Lblinfo. Text = "Incorrect email address ";
}
Else if (result = 6)
{
Lblinfo. Text = "the number of free user verifications exceeds (50 times/24 hours )";
}
Else if (result = 7)
{
Lblinfo. Text = "commercial users cannot pass Verification ";
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.