How to open a URL in new window using WebBrowser control in c# Windows Forms application and read its header information (via regex etc)

StackOverflow https://stackoverflow.com/questions/20499878

Question

As said, I would like to open a URL in a new window (not the default IE browser instance of WebBrowser control) and read the Header information in order to retrieve a token. Currently, I am using the below code that opens in a new IE instance.

webBrowser1.Navigate(myLink, true);

If I use the below code,

webBrowser1.Navigate(new Uri(myLink));

it opens in the current window, I need it to open in a new WINDOW.

Any help would be greatly appreciated.

Was it helpful?

Solution

Make a new form with just the web browser and call it from your current form.

OTHER TIPS

u can use this code for open in a new window:

WebBrowser1.Navigate(url.SettingsValue, "_blank", post, headers);
  1. Parameter => url.SettingsValue = your url address

  2. Parameter => "_blank" = for new blank

  3. Parameter => post (your choice) = your token or password

  4. Parameter => headers (your choice) = token header like => "Authorization: Basic " + auth + "\r\n";

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top