c# – 如何使用USPS验证给定的地址?
发布时间:2020-12-15 03:58:26 所属栏目:百科 来源:网络整理
导读:我想验证给予的地址(地址,城市,州,邮政编码)给USPS并返回结果,如果提供的地址是一个有效的地址.并且如果不是有效地址返回无效地址. 那么我如何在C#.Net中做到这一点. 解决方法 从 here ///Create a new instance of the USPS Manager class///The constructo
我想验证给予的地址(地址,城市,州,邮政编码)给USPS并返回结果,如果提供的地址是一个有效的地址.并且如果不是有效地址返回无效地址.
那么我如何在C#.Net中做到这一点. 解决方法
从
here
///Create a new instance of the USPS Manager class ///The constructor takes 2 arguments,the first is ///your USPS Web Tools User ID and the second is ///true if you want to use the USPS Test Servers. USPSManager m = new USPSManager("YOUR_USER_ID",true); Address a = new Address(); a.Address2 = "6406 Ivy Lane"; a.City = "Greenbelt"; a.State = "MD"; ///By calling ValidateAddress on the USPSManager object,///you get an Address object that has been validated by the ///USPS servers Address validatedAddress = m.ValidateAddress(a); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |