Postal Address Verification Data Returns in .NET C#

This is a tutorial on how to program the PAV API avoid invalid or incorrect address entries.

This simple web form that was created using Visual Studio’s C# ASP.NET Web Forms Application to verify an address before completing an entry to the database.


This is how it was programmed:


This section of code is for aesthetics and will be visible when completing the form.


Once you have created a new project within Visual Studio, you will need to add the API WSDL ( the project as a service reference. Once it has been added you would then need to include it in the very top section of the “Default.aspx.cs” page as shown below in the highlight yellow box. In our case we have named the project “VerifyAddress” and given the service reference the name of “WSDL”.

service reference

After the service reference has been added, we then navigate to the “Default.aspx” page within the project and add the necessary text boxes and button.



Now that the textboxes and button have been created, the portion of code below is added to the “Default.aspx.cs” page.  The API request code is contained within the “Submit” button click event.  All information passed along within the request with the exception of the parameter :”Urbanization” (which is used for address within Puerto Rico only) and the API license key are passed from the textboxes to the request code once an end user presses “Submit”.

After the address has been submitted, the end user would receive an alert box notating if there was an error verifying the address and if so, the error is explained and the user is asked to re-enter the address.  If no errors occur and the address verifies successfully (CDYNE ReturnCode of 100, 101, 102, or 200) the end user receives an alert box stating their order has been successfully submitted.

Once the “OK” button is pressed on the alert box, the textboxes on the form then display the text as it was shown when the page was first loaded and another address can be verified.

Get your free trial key with 50-100 address verifications here

Leave a reply