Я боролся с этим в течение трех дней, я хочу сделать ручную публикацию стороннему провайдеру, который затем получит данные от веб-пользователя (в данном случае провайдер PayFast), а затем перенаправит обратно на мой сайт в зависимости от успеха или неудачи.
Я попытался использовать несколько примеров на этом сайте и другие, в том числе один, который вручную воссоздает форму, как можно увидеть в (http://www.jigar.net/articles/viewhtmlcontent78.aspx) основной пример, который я нахожу, похож на пост на вопросы stackoverflow 1167067
вот результат в моем коде, который используется для создания потока, но я не могу понять, как отправить элемент управления на веб-сайт провайдеров, так как response.redirect убивает поток
string vystup = null;
//Our postvars
byte[] buffer = Encoding.ASCII.GetBytes(pPostData);
//Initialisation, we use localhost, change if appliable
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(PF_HOST);
//Our method is post, otherwise the buffer (postvars) would be useless
WebReq.Method = "POST";
//We use form contentType, for the postvars.
WebReq.ContentType = "application/x-www-form-urlencoded";
//The length of the buffer (postvars) is used as contentlength.
WebReq.ContentLength = buffer.Length;
//We open a stream for writing the postvars
Stream PostData = WebReq.GetRequestStream();
//Now we write, and afterwards, we close. Closing is always important!
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
//Get the response handle, we have no true response yet!
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
//Let's show some information about the response
PostResult = "=Status Code: " + WebResp.StatusCode ;
Console.WriteLine(WebResp.Server);
//Now, we read the response (the string), and output it.
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
vystup = _Answer.ReadToEnd();
PostResult = "redirect called...";
// Need to now send the post form to PayFast