Wednesday, November 25, 2026

Rupees to currency conversion

 

How to convert indian rupees to selected country currency in aspx page

You can convert Indian Rupees (INR) into selected country currencies in an ASP.NET Web Forms (.aspx) page using C# and a Currency Exchange Rate API.

For example:

  • India → INR

  • USA → USD

  • UK → GBP

  • UAE → AED

  • Europe → EUR

  • Japan → JPY

I recommend using a country dropdown and automatically calculating the converted amount.

1. ASPX Design Page (Currency.aspx)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Currency.aspx.cs" Inherits="CurrencyConverter.Currency" %> <!DOCTYPE html> <html> <head runat="server"> <title>Currency Converter</title> </head> <body> <form id="form1" runat="server"> <h2>INR Currency Converter</h2> <asp:Label ID="Label1" runat="server" Text="Enter Amount (INR):" /> <br /> <asp:TextBox ID="txtAmount" runat="server" Text="1000" /> <br /><br /> <asp:Label ID="Label2" runat="server" Text="Select Country:" /> <br /> <asp:DropDownList ID="ddlCountry" runat="server"> <asp:ListItem Text="USA - USD" Value="USD" /> <asp:ListItem Text="UK - GBP" Value="GBP" /> <asp:ListItem Text="UAE - AED" Value="AED" /> <asp:ListItem Text="Europe - EUR" Value="EUR" /> <asp:ListItem Text="Japan - JPY" Value="JPY" /> <asp:ListItem Text="Canada - CAD" Value="CAD" /> <asp:ListItem Text="Australia - AUD" Value="AUD" /> </asp:DropDownList> <br /><br /> <asp:Button ID="btnConvert" runat="server" Text="Convert Currency" OnClick="btnConvert_Click" /> <br /><br /> <asp:Label ID="lblResult" runat="server" ForeColor="Blue" /> </form> </body> </html>

2. C# Code Behind (Currency.aspx.cs)

We can use the free exchange-rate API from Frankfurter.

API example: https://api.frankfurter.dev/v1/latest?base=INR&symbols=USD


using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Script.Serialization;

namespace CurrencyConverter
{
    public partial class Currency : System.Web.UI.Page
    {
        protected async void btnConvert_Click(object sender, EventArgs e)
        {
            try
            {
                decimal amount;

                if (!decimal.TryParse(txtAmount.Text, out amount)
                    || amount <= 0)
                {
                    lblResult.Text = "Please enter a valid amount.";
                    return;
                }

                string currency = ddlCountry.SelectedValue;

                string url = "https://api.frankfurter.dev/v1/latest?base=INR&symbols="
                             + currency;

                using (HttpClient client = new HttpClient())
                {
                    string json = await client.GetStringAsync(url);

                    JavaScriptSerializer js =
                        new JavaScriptSerializer();

                    dynamic data = js.DeserializeObject(json);

                    var rates =
                        (System.Collections.Generic.Dictionary<string, object>)
                        data["rates"];

                    decimal rate = Convert.ToDecimal(rates[currency]);

                    decimal convertedAmount = amount * rate;

                    lblResult.Text =
                        amount.ToString("N2") + " INR = " +
                        convertedAmount.ToString("N2") + " " + currency +
                        "<br/>Exchange Rate: 1 INR = " +
                        rate.ToString("N6") + " " + currency;
                }
            }
            catch (Exception ex)
            {
                lblResult.Text = "Conversion Error: " + ex.Message;
            }
        }
    }
}

3. Expected Output

INR Currency Converter

Example interface — exchange rate is fetched live when the application runs.

Note: The example above demonstrates the interface; the actual ASP.NET page uses the API code.

4. Important Requirements

  1. Add System.Net.Http reference.

  2. Ensure your .NET Framework version supports async and await (4.5 or later).

  3. Configure HTTPS access from your hosting server.

  4. Handle API errors and invalid currency codes.

  5. For financial transactions, use a trusted exchange-rate provider and verify its update frequency.

My recommendation: If you are developing this as a reusable module, create a separate CurrencyConverter.cs class and call it from any ASPX page.

I can also help you build a complete ASP.NET Web Forms Currency Converter with all country currencies, country flags, live exchange rates, and automatic conversion without page refresh (AJAX).

For currency conversion in an ASPX page, here’s an AI app builder option.

Rupees to currency conversion

  How to convert indian rupees to selected country currency in aspx page You can convert Indian Rupees (INR) into selected country currencie...