Reputation: 4662
I am displaying a specific webpage on a browser control and not allowing them to browse to any other page.
When the user clicks the submit button to go to the next page I need to grab the post data and then display the page.
I've not used the browser control before so I need to get this information then display the page.
My web page is displaying without any problems but I'm not sure how to grab the post data after they click submit.
Here is my form so far...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ssscc
{
public partial class GatewayNavigation : Form
{
public Size WindowSize { set; get; }
public GatewayNavigation()
{
InitializeComponent();
InitializeEvents();
Size = GatewayNavigationFormSettings.FormSize;
}
private void InitializeEvents()
{
Load += GatewayNavigationLoad;
webBrowser_Gateway.DocumentCompleted += WebBrowserGatewayDocumentCompleted;
webBrowser_Gateway.ProgressChanged += WebBrowserGatewayProgressChanged;
}
void WebBrowserGatewayProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
if (e.MaximumProgress > 0)
{
int prog = (int)(100 * e.CurrentProgress / e.MaximumProgress);
if (prog > 99)
{
prog = 100;
}
progressBar1.Value = prog;
}
}
void WebBrowserGatewayDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
progressBar1.Visible = false;
}
private void GatewayNavigationLoad(object sender, EventArgs e)
{
webBrowser_Gateway.AllowNavigation = false;
webBrowser_Gateway.AllowWebBrowserDrop = false;
webBrowser_Gateway.Navigate(UrlBuild.FullUrl);
}
}
}
Anyone have any suggestions?
Upvotes: 0
Views: 8784
Reputation: 8469
Handle the WebBrowser.Navigating
event and check WebBrowserNavigatingEventArgs.Url
.
EDIT: my apologies, my answer was misleading. You can't extract POST
parameters from that. I've done a little research and found this question, which I hope to be helpful to solve the problem. I have tried the example using the dynamic
keyword but it didn't seem to work for me.
Upvotes: 2