c# - use HttpClient for form submittion -




in c# code need post form other website payment gateway, can adding html tags webform , submitpage on body load. i wants in more proper way using httpclient. when post http call client url data values. page dont redirect me payment website.is there code work in same way when post form manualy. here code snippet form submisttion manualy:(its working)

<form action="https://somewebsite.com/someurl" method="post" target="_blank"> <input name="token" value="mytokenparameter" hidden = "true"/>  <input name="postbackurl" value="http://mywebsite.com/status.aspx" hidden = "true"/>  <input value="confirm" type = "submit" name= "pay"/>  </form> 

here c# code submit same data httpclient:(its not redirecting user payment website)

private async task processasyncrequest() {     using (var client = new httpclient())     {         var values = new list<keyvaluepair<string, string>>();         values.add(new keyvaluepair<string, string>("token", "mytokenparameter"));         values.add(new keyvaluepair<string, string>("postbackurl","http://mywebsite.com/status.aspx"));         var content = new formurlencodedcontent(values);         var response = await client.postasync("https://somewebsite.com/someurl",content);         var responsestring = await response.content.readasstringasync();         response.write(responsestring);     } } 

is possible httpclient let user move client site in response?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -