Pergunta

I have a problem sending postData while user click on button on some webpage. It means that postData cannot be Null. Here is the code:

webBrowser1.Navigate(e.Url, "_self", default(byte[]), headers);

As you can see I've used default(byte[]) for postData overload, but this is not working. What I'm trying to do is NOT to change post data, just headers.

Edit: I do this like this:

private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
                .
                .
                .    
                webBrowser1.Navigate(e.Url, "_self", default(byte[], headers);

                .
                .
                . 
        }

When the browser is navigating I add headers. This works, but when user press on some button or writes username and password into login forum and press submit, it doesn't work.

Foi útil?

Solução

Just pass empty byte array. default of array is null, because arrays are reference type.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top