1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CurrencyConverter._Default" %>
2:
3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4:
5: <html xmlns="http://www.w3.org/1999/xhtml">
6: <head runat="server">
7: <title>Simple Currency Converter using ASP.Net</title>
8: <% if (Request.RequestType == "POST")
9: {
10: NameValueCollection nv = new NameValueCollection();
11: nv.Add("FromCurrency", Request.Form["FromCurrency"]);
12: nv.Add("ToCurrency", Request.Form["ToCurrency"]);
13: System.Net.WebClient wc = new System.Net.WebClient();
14: wc.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
15: byte[] responseArray = wc.UploadValues("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate", "POST", nv);
16: lblCurrency.Text = Encoding.ASCII.GetString(responseArray);
17: //Response.Write();
18:
19:
20: }
21: %>
22: </head>
23: <body>
24: <h2><center>Simple Currency Converter using ASP.Net</center></h2>
25: <form id="currency" method="post">
26: From : <input type="text" name="FromCurrency" /><br /><br />
27: To : <input type="text" name="ToCurrency" /><br /><br />
28: <input type="submit" value="Convert" />
29: </form>
30: Kurs Sekarang adalah : <asp:Label ID="lblCurrency" runat="server" Text=""></asp:Label>
31: </body>
32: </html>