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
  1. Home
  2. Web Development
  3. ASP.NET
  4. How do I POST back a specific header

How do I POST back a specific header

Scheduled Pinned Locked Moved ASP.NET
questioncsharp
4 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.
  • W Offline
    W Offline
    Wombaticus
    wrote on last edited by
    #1

    AM trying to integrate an online payment system, where the secure payment gateway will send a notification to a specified URL on my site - I have given a generic handler (.ashx) address. I can read the data they send (it's a simple POST), but they require that I send back: a notification with a response of: "HTTP/1.1 200 OK". I am not sure what they want... Is a simple

    context.Response.ContentType = "text/plain"
    context.Response.Write("HTTP/1.1 200 OK")

    enough? Perhaps necessarily preceded with

    context.Response.StatusCode = 200

    ? Or is something more sophisticated required, along the lines of

    Dim req As System.Net.HttpWebRequest = System.Net.WebRequest.Create("https://secure-gateway-url")
    req.Method = "POST"
    req.ContentType = "application/x-www-form-urlencoded"
    req.Accept = "HTTP/1.1 200 OK"  ?????
    req.Headers .Add (   ?????
    Dim param As Byte() = context.Request.BinaryRead(HttpContext.Current.Request.ContentLength)
    Dim strRequest As String = Encoding.ASCII.GetString(param)
    req.ContentLength = strRequest.Length
    Dim streamOut As System.IO.StreamWriter = New System.IO.StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII)
    streamOut.Write(strRequest)
    streamOut.Close()
    

    with what needed at the lines flagged ???? I’d be very grateful for any advice... thanks

    J 1 Reply Last reply
    0
    • W Wombaticus

      AM trying to integrate an online payment system, where the secure payment gateway will send a notification to a specified URL on my site - I have given a generic handler (.ashx) address. I can read the data they send (it's a simple POST), but they require that I send back: a notification with a response of: "HTTP/1.1 200 OK". I am not sure what they want... Is a simple

      context.Response.ContentType = "text/plain"
      context.Response.Write("HTTP/1.1 200 OK")

      enough? Perhaps necessarily preceded with

      context.Response.StatusCode = 200

      ? Or is something more sophisticated required, along the lines of

      Dim req As System.Net.HttpWebRequest = System.Net.WebRequest.Create("https://secure-gateway-url")
      req.Method = "POST"
      req.ContentType = "application/x-www-form-urlencoded"
      req.Accept = "HTTP/1.1 200 OK"  ?????
      req.Headers .Add (   ?????
      Dim param As Byte() = context.Request.BinaryRead(HttpContext.Current.Request.ContentLength)
      Dim strRequest As String = Encoding.ASCII.GetString(param)
      req.ContentLength = strRequest.Length
      Dim streamOut As System.IO.StreamWriter = New System.IO.StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII)
      streamOut.Write(strRequest)
      streamOut.Close()
      

      with what needed at the lines flagged ???? I’d be very grateful for any advice... thanks

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      I think this post may answer your question, just change the code to 200 http://stackoverflow.com/questions/4495961/how-to-send-a-status-code-500-in-asp-net-and-still-write-to-the-response[^]

      W 1 Reply Last reply
      0
      • J jkirkerx

        I think this post may answer your question, just change the code to 200 http://stackoverflow.com/questions/4495961/how-to-send-a-status-code-500-in-asp-net-and-still-write-to-the-response[^]

        W Offline
        W Offline
        Wombaticus
        wrote on last edited by
        #3

        Thanks - Google doesn't like me, I've decided :( I did try and Google this myself....

        J 1 Reply Last reply
        0
        • W Wombaticus

          Thanks - Google doesn't like me, I've decided :( I did try and Google this myself....

          J Offline
          J Offline
          jkirkerx
          wrote on last edited by
          #4

          I've written that before years ago, it was just easier for me to find it through search and post a link. Took me a while to find the right one.

          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