- "Start" - "All Programs" - "Microsoft Visual Studio 2010".
- "File" - "New Project" - "C#" - "Empty Project" (to avoid adding a master page).
- Give the Project name (such as LiveCurrencyconverter) or another as you wish and specify the location.
- Then right-click on Solution Explorer - "Add New Item" - "Default.aspx" page.
- Then right-click on Solution Explorer - "Add New Item" - "WebService.asmx" page.
- To see the "Default.aspx" source code please download the sample zip file.
Use the following code in WebService.asmx.cs of the WebService.asmx page:
In the preceding web services I have used one string named URL; on it I have saved a path of the Google API. Now add the service reference of the WebService.asmx web service to the Default.aspx page by right-clicking on the Solution Explorer, now run the application which looks such as in the following:
The above is the sample screen of an application, now provide the Input i9n above fields and click on "Convert" Button; the output will be as follows:
In the preceding Screen we can clearly seen that, I have converted 1 USD into Indian Rupees and the output is exactly the current market price, which is 54.58Rs.
- Convert any country's currency using the current live market value.
- You have no need of a database to store the data.
- The free of cost API is provided by Google; there is not even a hidden cost.
- For more code please download the sample zip file.
- Before using this article please read about the basics of Web Services, if you are unfamiliar with it.
I hope this article is useful for all readers, if you have any suggestion then please contact me, because of your suggestion others can get help from this article by improving it.