Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to send a post request from one server to another

How to send a post request from one server to another

Scheduled Pinned Locked Moved ASP.NET
helpsysadmintutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vnr
    wrote on last edited by
    #1

    Hi, In our site I am trying to integrate the CITI Bank payment gateway .For canceling a payment we need to send the post request from merchant site to payment gateway site .For this I am using the web request method , I am posting the parameters to the payment gateway server using the web request but not getting the web response , it is giving the error as The remote server returned an error: (500) Internal Server Error . I am not understanding whether the problem is with the web request or I am not sending the request properly to the gateway . Can anyone please let me know is there any other way to post the request from server to server other than web request method . Thanks in advance

    S 1 Reply Last reply
    0
    • V vnr

      Hi, In our site I am trying to integrate the CITI Bank payment gateway .For canceling a payment we need to send the post request from merchant site to payment gateway site .For this I am using the web request method , I am posting the parameters to the payment gateway server using the web request but not getting the web response , it is giving the error as The remote server returned an error: (500) Internal Server Error . I am not understanding whether the problem is with the web request or I am not sending the request properly to the gateway . Can anyone please let me know is there any other way to post the request from server to server other than web request method . Thanks in advance

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      vnr wrote:

      The remote server returned an error: (500) Internal Server Error

      If you are sending web request as per their code functionality then its not your error.Sometimes if you are not sending all the parameters which the gateway needs then this error may occur..! Sometimes the http request waits for particular time to get the response from the server and if it did not get any response this error may occur..! Here is the sample method for authorize .net for gateway hope it helps..!

      private string CreditCardCheck()
      {
      
         
          String strPost = "x\_login=" + loginID + "&x\_tran\_key=" + trans\_Key ;
          StreamWriter myWriter = null;
          string url ="https://secure.authorize.net/gateway/transact.dll";
          HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
          objRequest.Method = "POST";
          objRequest.ContentLength = strPost.Length;
          objRequest.ContentType = "application/x-www-form-urlencoded";
      
          try
          {
              myWriter = new StreamWriter(objRequest.GetRequestStream());
              myWriter.Write(strPost);
          }
          catch (Exception ex)
          {
              logger.Error(ex.Message);
          }
          finally
          {
              myWriter.Close();
          }
      
          HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
          using (StreamReader sr =
             new StreamReader(objResponse.GetResponseStream()))
          {
              result = sr.ReadToEnd();
      
              string\[\] responsedetails = result.Split('|');
              TrasactionId = responsedetails\[6\].ToString();
             // Close and clean up the StreamReader
              sr.Close();
          }
          if (result.ToLower().Contains("invalid") || result.ToLower().Contains("inactive"))
          {
              
              return "CreditCardis notvalid";
      
          }
          return TrasactionId ;
      }
      

      LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups