Turn Left - A weblog by InetSolution

.Net Component to Perform ABA Validation

By Justin Gattuso
Posted on Nov 21, 2006

Here at InetSolution we do a lot of work with banking applications and due to this we run into the need to validate ABA numbers for proper length, format and checksum. ABA numbers are bank routing and transit numbers that are assigned to banks and credit unions in the United States. These are 9 digit values with a built-in checksum value that results from an internal algorithm to ensure that a given 9 digit string is in fact a real ABA number.

We have a small and very simple component to help programmers using .NET to perform the ABA validation without worrying about the internal algorithm involved, just feed it a string and it will perform its magic to let you know if the string is a validly formatted ABA number or not, and if it isn’t, how it is wrong so you can let your users know.

This method is a static method, it doesn’t require the instantiation of any objects and is about as simple to use as you can wish for. To use, simply make a reference to InetSolution.Banking namespace and the static function ‘ValidateABANumber’ will be available for you to use.

Here are some code examples to show how simple and flexible this little function is:

ValidateABANumberResult oResult = Validation.ValidateABANumber(sInput);
if(oResult.IsValid)
{
Console.WriteLine("Valid ABA Number.");
}
else
{
Console.WriteLine("Invalid ABA Number.");
}

The code above is checking an input string for a valid ABA number. It's doing so by checking the resulting object's ‘IsValid’ property, which is simply a boolean value that will tell you whether or not the value submitted is a valid ABA number or not (i.e., a 9 digit number that passes the ABA checksum test).

Here is another example that makes use of customized error messaging using return codes:

ValidateABANumberResult oResult = Validation.ValidateABANumber(sInput);
if(oResult.Code == ABANumberResultCode.ABA_PASSED)
{
    Console.WriteLine("Valid ABA Number.");
}
else if(oResult.Code == ABANumberResultCode.ABA_FAILED_EXPRESSION)
{
    Console.WriteLine("Invalid, an ABA number must contain 9 numeric characters.");
}
else if(oResult.Code == ABANumberResultCode.ABA_FAILED_CHECKSUM)
{
    Console.WriteLine("Invalid, the value entered is not a valid ABA number.");
}

There is also a message property on the result object that just returns some static text associated with a failure code. This is useful if you just want to use a stock error message and don’t need to worry about customizing it for your application. The codes are useful for customizing based on the return result and the IsValid property is probably the simplest thing to use.

You can purchase this component for a tiny little price of $10.00. If you're building any type of .Net application or ASP.Net website, this will pay for itself on your first use. :)

Who is InetSolution?

Donovan - Creative Director
Justin - Lead Architect & Developer
Somer - Graphic Designer
Mac - Programmer
Larry - Programmer
Mosh - Programmer
Paul - Technical Sales Architect
Jay - Weekend & Holidays Sys Admin
Karen - Business Development & Client Care
Jason - Project Director

Our Services

Web Design/Development
We practice a user-centered development philosophy. We work with clients who place their customer's needs first. We need to know who will use your site and why.
Secure File Exchange
Turn your website into a state-of-the-art file exchange system, requiring only a web browser, username and a password.
eCommerce Web Development
We have experience, know-how and superior customer support to ensure that your store is profitable and that your investment with InetSolution earns a high return.
Disaster Recovery Hosting
We provide fully-managed SQL server database hosting for companies seeking a warm disaster recovery site.

Category Archives

About InetSolution

We make business websites profitable. We do it with usable design, solid programming and unique, methodical marketing.