I have an external webpage that I need to access using a HTTP Post, and include in an iframe. The webpage has an example set of instructions to access the page, listed below, but they assume a Windows Form solution; I am using ASP.NET MVC, instead.
How can I convert this WebBrowser centric solution into something that can successfully post to the external site, and load the results into an iframe?
private WebBrowser wb_inline = null;
private void Submit_Click(object sender, EventArgs e)
{
string url = "http://www.example.com";
string setupParameters = "account_token=abc123";
ServicePointManager.ServerCertificateValidationCallback =
(s, cert, chain, ssl) => true;
ASCIIEncoding encoding = new ASCIIEncoding();
var postData = setupParameters;
if (null == wb_inline)
{
wb_inline = new WebBrowser(this);
wb_inline.Location = new System.Drawing.Point(100, 277);
wb_inline.Size = new System.Drawing.Size(675, 650);
}
Controls.Add(wb_inline);
wb_inline.Visible = true;
string AdditionalHeaders = "Content-Type: application/json";
byte[] data = encoding.GetBytes(postData);
wb_inline.Navigate(payProsUrl, "", data, AdditionalHeaders);
}
Is there a way to do something like this, with a HttpWebResponse (or some other control), and include this in an iframe? I've been trying to adapt this, but without success yet.