What is the best way to open a URL in a IE BHO in VB.Net?

Add-in Express™ Support Service
That's what is more important than anything else

What is the best way to open a URL in a IE BHO in VB.Net?
VB.Net, BHO, Internet Explorer 
Alexander Desuasido




Posts: 78
Joined: 2009-04-03
I am new to VB.Net and looking for the best way to get source from a given URL.

I am hoping to accomplish the following:

1. Give Subroutine a URL
2. If URL is a "redirect" page, then iterate through redirects until landing on "final" page
3. If any of the pages visited sets cookies, then set the cookies for the user.
4. Return with String of HTML Source

I have been trying to do this with XMLHTTP, WebRequest, and I am looking for other ways online. If anyone with experience in this has a quick answer, i would greatly appreciate it.


Posted 03 Apr, 2009 17:51:58 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello Alexander,

Please have a look at the Advanced Search sample add-in for IE. You can download its sources here.

1. You can use the BeforeNavigate2 or DocumentComplete events.
2. Please see the IEApp.Navigate method.
3. You can use the cookie property of the HTMLDocument.
4. You can set any cookie in the Navigate method.
.NET, Extended MAPI, Windows Phone & RT
Posted 06 Apr, 2009 09:51:05 Top
5States 5States




Posts: 78
Joined: 2009-04-03
Eugene:

Big thanks again for the info on IEApp.Navigate!!

What is the protocol when two IEApp.Navigate are called in Add-in Express? In my experiments, the first one does not get called and 2nd one is the only one that is brought to the browser.

If I want a series (more than one, say 2) URLs to be loaded consecutively, what is the best way to accomplish this?

IEApp.Navigate(url1)
IEApp.Navigate(url2)

The above is only loading url2 (perhaps by design, or maybe my testing). Anyone with ideas would be much appreciated!

Have a great day smart people! (yes, I'm talking to you)

5
Posted 08 Apr, 2009 20:28:01 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello,

Please note that the browser is smart enough too :-) It looks like it optimizes connections to the server.
.NET, Extended MAPI, Windows Phone & RT
Posted 09 Apr, 2009 03:54:29 Top