I am using a webbrowser control to get some information from a website. It has a detail link, which when clicked, opens a popup window and shows the details in the webbrowser.
How can I do these if click the link in webbrowser control (by program) open another window and showing execution error.
But in explorer it is working. And I noticed that detail link works only if I open the main page in Internet Explorer, otherwise if I call the detail URL directly from Internet Explorer, it also gives me the same error.
I recently ran across a very similar situation. In my case, the popup browser didn't share the session of the embedded browser. What I had to do was capture the NewWindow event and cancel it, then send the intended URL to the embedded browser. I needed to use the ActiveX browser instance because it gives you the URL that was attempting to launch. Here is my code:
You will need to add the Microsoft Internet Controls COM reference to your project for this to work.
this is dynamic version. it doesnt require statically bind com interop which is always problem in future versions of windows.
Refine to Middas answer...