How do I POST back a specific header
-
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
-
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
-
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[^]
Thanks - Google doesn't like me, I've decided :( I did try and Google this myself....
-
Thanks - Google doesn't like me, I've decided :( I did try and Google this myself....