0

I'm using the WPF version of the DotNetBrowser control.

Currently when calling the LoadURL(string url) method, the browser is invoking the request using the GET verb (as expected). In my case, I need to add some custom HTTP headers in the request so I am using the LoadURL(LoadURLParams parameters) method which basically allows me to set whatever headers I want (as described in the official documentation https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110056-loading-url-with-post) except it is using POST.

My problem is that the server I'm sending the request to only accepts GET requests for navigation.

Is there any way of configuring the navigation so it would use GET also when setting custom headers?

Thanks!

1 Answers1

0

In order to send GET request with specified headers, you need to create LoadURLParams with an empty postData parameter.

Browser browser = BrowserFactory.Create();
browser.LoadURL(new LoadURLParams("https://jsonplaceholder.typicode.com/posts?userId=1",
   "", "Content-Type: text/plain\n"));
  • Thank you, that did it. In my case I was setting the proper headers, however for the second parameter I was using a dummy value instead of empty string. – Cristian M. Oct 24 '18 at 13:56