zondag, augustus 19, 2007
Country list
Today I started working on the profile page of the about2findout.com site-to-be. You would think it is simple to find a control that displays all known countries ready to plug into an asp.net application. But I only found a few. For example on egghead cafe. That is nice, but requires the list to be hard coded, which is not very maintenance-friendly. After all, the former Yugoslavia still splits off new countries every year :-). Luckily, Mads Christensen's blog has an XML file with all countries available. I've changed it a bit so the country name is an attribute like the code and ISO country number because that way asp.net is able to directly use it as an XML data source and I don't have to write any additional code.
In case you need it too, this the modified country-names.xml file, ready to serve as an XML data source and be bound to any capable asp.net control such as listbox or checkboxlist.
I also wanted to pre-populate the box with the country the IP connection originates from. I found a nice article by AdamNajmanowicz on Codeproject. It has a module to detect the country based on the IP address. It makes use of the geoiptool.com site to get country, region and provider information based on the IP address. Of course, this system is not 100% accurate and can be bypassed, but is makes a nice start to detect a user's country.
In case you need it too, this the modified country-names.xml file, ready to serve as an XML data source and be bound to any capable asp.net control such as listbox or checkboxlist.
I also wanted to pre-populate the box with the country the IP connection originates from. I found a nice article by AdamNajmanowicz on Codeproject. It has a module to detect the country based on the IP address. It makes use of the geoiptool.com site to get country, region and provider information based on the IP address. Of course, this system is not 100% accurate and can be bypassed, but is makes a nice start to detect a user's country.
Labels: asp.net, country list
