How to submit a form from C #
I am developing an internal application in C # that calls one of the banking sites. I need to enter a value in DDL, quantity in a textbox and neeed to find out the exchange rate.
here is the link i need to use.
https://www.timesofmoney.com/remittance/secure/rmtExchRateCalculator.jsp?tab=US&sendercountry=US&sendercurrency=USD&uiId=TOML&partnerId=TOML I used myWebClient.UploadValues (C #) but the site is returning some errors can anyone help me with this.
My code:
string uriString= "https://www.timesofmoney.com/remittance/secure/rmtExchRateCalculator.jsp?tab=US&sendercountry=US&sendercurrency=USD&uiId=TOML&partnerId=TOML";
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL.
NameValueCollection myNameValueCollection = new NameValueCollection();
// Add necessary parameter/value pairs to the name/value container.
myNameValueCollection.Add("selCountry", "United States");
myNameValueCollection.Add("rmtAmount", "100");
byte[] responseArray = myWebClient.UploadValues(uriString, myNameValueCollection);
Response.Write(Encoding.ASCII.GetString(responseArray));
The answer I received from the site:
The inconvenience is sorry!
Please check your browser settings so that you can use the site. You may face this problem due to old cookies and temporary internet files.
Delete temporary Internet files.
To remove temporary Internet files, follow these steps: Start Internet Explorer. From the Tools menu, select Internet Options and go to the General tab. In the "Temporary Internet Files" section, click "Delete Cookies". Click OK when you are prompted to confirm the deletion. Click "Delete Files". Click OK when you are prompted to confirm the deletion. In the "History" section, click "Clear history". Click "Yes" when prompted to delete your browsing history. Click OK. Close all open browsers and start your new browser again.
a source to share
The page seems to require cookies. Take a look here to learn how to handle cookies using the WebClient.
To debug your problem, you can also install a header nulling tool like Live HTTP Headers for Firefox or ieHTTPHeaders for Internet Explorer and try to send the same information through the WebClient (same User Agent, Referrer , etc.).
a source to share