0

Our third party payment gateway provider only supports the FORM POST for handshake, payment and payment verification etc.

For this we need to perform a POST from C#.NET. Could someone help me whether there's any NUGET Packages or samples to achieve this?

I had a look at this already but did not find elegant:

4
  • What is the problem with the solution described in the MSDN-article? Commented Apr 23, 2015 at 11:29
  • @stefankmitph He actually asks for a different solution. Commented Apr 23, 2015 at 11:29
  • @PatrikEckebrecht yeah, and the duplicate question with the highest rated answer offers 3 different solutions. Commented Apr 23, 2015 at 11:35
  • stackoverflow.com/questions/15176538/… Commented Apr 23, 2015 at 11:37

1 Answer 1

1

One easy way is to use RestSharp.

This is a sample POST request.

using RestSharp; var client = new RestClient("http://example.com"); // client.Authenticator = new HttpBasicAuthenticator(username, password); var request = new RestRequest("resource/{id}", Method.POST); request.AddParameter("name", "value"); request.AddUrlSegment("id", "123"); // easily add HTTP Headers request.AddHeader("header", "value"); // add files to upload (works with compatible verbs) request.AddFile(path); // execute the request RestResponse response = client.Execute(request); 
Sign up to request clarification or add additional context in comments.

1 Comment

Per my post, it's not a REST or SOAP service. It's just aspx page which accepts form post. For initial hand shake we need to post data via code.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.