ValidPhoneMx Web Service Sample ASP.Net

<%@ Page Language="VB" trace="false" debug="false" %>
'****  First add a reference to the Proxy Class you should create with Visual Studio
'**** making a reference to http://www.ilion-strategies.com/ws/validphonemx.asmx web service
'**** When you create the proxy class you can give it a name. In our example we called it validphonmex
<%@ Import Namespace="ValidPhoneMx"%>



<head>

<script runat=server>
'**** Declare a variable to hold the webservice results with a structure defined in the ws, i.e. RevisedPhone
Public  PhoneResults as RevisedPhone
Public AllowedTries as Integer=15

Sub Page_Load
     If (Session("ValidPhoneCounter") = Nothing) Then
      Session("ValidPhoneCounter") = 0
     End if

End Sub

Sub RevPhone(s as Object, e as EventArgs)
'**** Declare an instance of the webservice class, i.e. validphonemx
'**** Remember, you can use WSDL to get a description of the webservice
    dim Nphone as ValidPhoneMx
    nphone = New ValidPhoneMx()
     dim StrPhone as string
    Session("ValidPhoneCounter")=Session("ValidPhoneCounter")+1
    if Session("ValidPhoneCounter")>=AllowedTries then
        Warning.text=AllowedTries.Tostring.Format("We are sorry but you are allowed only {0} tries per day in this page!")
        table1.visible=false
    else
	PhoneResults =nphone.chkphone(phone2validate.text,"Write here your license key")
        table1.visible=true
    end if
End sub




</script>


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="Author" content="ilion-strategies">
<meta name="Copyright" content="Copyright 2001 - ilion-strategies">
<title>ValidPhoneMX WebServices Sample ASP.Net Page</title>


<link rel="stylesheet" type="text/css" href="../images/ilion1.css">


</head>

<body topmargin="0" leftmargin="0" onload="dynAnimation()" language="Javascript1.2">
<form runat=server>
  <h4>Try ValidPhoneMx Web Service</h4>
    <p class="medio">Instructions:</p>
    <ul>
        <li>
        <p class="medio">Enter a 10 digit <b>Mexico's</b> telephone number.&nbsp; Samples: 5553262626, 6671070156.</p></li>
        <li>
        <p class="medio">Hit the &quot;invoke&quot; button.</p></li>
    </ul>
    <p class="medio">
    <table style="border-collapse: collapse" border="1" bordercolor="#1E95C7"><tr><td>
        <table border="0" bordercolor="#1E95C7">
            <tr>
                <td>Phone Number to Validate:</td>
                <td>
                    <asp:TextBox ID=phone2validate Runat=server></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
		<asp:Button ID=invoke 
		Runat=server Text=Invoke 
		OnClick=RevPhone></asp:Button>
                </td>
            </tr>
        </table>
    </td></tr></table>
    </p>
    <p>&nbsp;</p>
      <table border="1" width="100%" id="table1" style="border-collapse: collapse" bordercolor="#C0C0C0" runat=server visible=false class=smlxt>
        <tr>
            <td bgcolor="#1E95C7">
            <p align="center"><font color="#FFFFFF"><b>Return Field</b></font></td>
            <td bgcolor="#1E95C7">
            <p align="center"><font color="#FFFFFF"><b>Return Value</b></font></td>
        </tr>
        <tr>
            <td>Status Code</td>
            <td><%= PhoneResults.Status %></td>
        </tr>
        <tr>
            <td>Status Description</td>
            <td><%= PhoneResults.StatusDescription %></td>
        </tr>
        <tr>
            <td>Census Key</td>
            <td><%= PhoneResults.CensusKey %></td>
        </tr>
        <tr>
            <td>Region</td>
            <td><%= PhoneResults.Region %></td>
        </tr>
        <tr>
            <td>State</td>
            <td><%= PhoneResults.State %></td>
        </tr>
        <tr>
            <td>Municipality</td>
            <td><%= PhoneResults.Municipality %></td>
        </tr>
        <tr>
            <td>ASL</td>
            <td><%= PhoneResults.ASL %></td>
        </tr>
        <tr>
            <td>Area Code</td>
            <td><%= PhoneResults.AreaCode %></td>
        </tr>
        <tr>
            <td>Network Type</td>
            <td><%= PhoneResults.NetworkType %></td>
        </tr>
        <tr>
            <td>Modality</td>
            <td><%= PhoneResults.Modality %></td>
        </tr>
        <tr>
            <td>Operated by</td>
            <td><%= PhoneResults.Operatedby %></td>
        </tr>
        <tr>
            <td>Previous Area Code</td>
            <td><%= PhoneResults.PreviousAreaCode %></td>
        </tr>
    </table>
        <asp:Label ID=warning Runat=server ForeColor=#CC0000 EnableViewState=False></asp:Label>
        </table msimagelist>
</form>
  </body>