Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to post HTML form from server side?
    text
    copied!<p>I want to post this form from server side (ASP.NET/C#):</p> <pre><code>&lt;FORM action="https://login:password@payment.architrade.com/cgi-adm/refund.cgi" method=POST&gt; &lt;input type="hidden" name="merchant" value="12345678"&gt; &lt;input type="hidden" name="transact" value="11111111"&gt; &lt;input type="hidden" name="amount" value="2000"&gt; &lt;input type="hidden" name="currency" value="208"&gt; &lt;input type="hidden" name="orderid" value="11223344"&gt; &lt;input type="hidden" name="md5key" value="cfcd208495d565ef66e7dff9f98764da"&gt; &lt;input type="hidden" name="textreply" value="yes"&gt; &lt;/FORM&gt; </code></pre> <p>I'm trying to use WebClient.UploadValues. My code is </p> <pre><code> private void PostRefundRequest(Mediachase.Commerce.Orders.Payment payment) { WebClient webClient = new WebClient(); NameValueCollection refundRequest = new NameValueCollection(); PaymentMethodDto dibs = PaymentManager.GetPaymentMethodBySystemName("DIBS", SiteContext.Current.LanguageName); string merchant = GetParameterByName(dibs, DIBSPaymentGateway.UserParameter).Value; PurchaseOrder po = payment.Parent.Parent as PurchaseOrder; string orderid = po.TrackingNumber; string transact = payment.TransactionID; string amount = (payment.Amount * 100).ToString(); refundRequest.Add("merchant", merchant); refundRequest.Add("transact", transact); refundRequest.Add("amount", amount ); refundRequest.Add("currency", payment.Parent.Parent.BillingCurrency); refundRequest.Add("orderid", orderid); string md5 = GetMD5KeyRefund(merchant, orderid, transact, amount); refundRequest.Add("md5key", md5); refundRequest.Add("textreply", "yes"); byte[] responseArray = webClient.UploadValues("https://&lt;mylogin&gt;:&lt;mypassword&gt;@payment.architrade.com/cgi-adm/refund.cgi", refundRequest); } </code></pre> <p>I tried to debug, and everything seems to be correct, but the API returns HTTP 401 (Unauthorized). My concern is: does WebClient.UploadValues support the url of the API (which includes username/password) </p> <p>Thank you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload