Handling main url in BeforeNavigate2 method

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

Handling main url in BeforeNavigate2 method
 
buy2change




Posts: 3
Joined: 2013-08-02
I would like to rewrite only main url with some extra parameters. And I need to do this just for GET requests.

I saw basic example on how to rewrite url. I want to extend this one to just MAIN (not sub requests) GET requests.

Could you please help?

Thanks
Posted 02 Aug, 2013 22:37:16 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello,

Below is a code fragment from the manual, see the PDF file in the folder {Add-in Express}\Docs on your development PC:

Redirecting to a web site.
'VB.NET
Imports AddinExpress.IE
Imports IE = Interop.SHDocVw
'
Private Sub IEModule_BeforeNavigate2 _
    (e As ADXIEBeforeNavigate2EventArgs) Handles MyBase.BeforeNavigate2

    If e.Url.ToString().ToLower().Contains("www.site1.com") Then
        e.Cancel = True
        Me.IEApp.Navigate2("www.site2.com")
    End If
End Sub


Hope this helps.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Aug, 2013 02:09:10 Top
buy2change




Posts: 3
Joined: 2013-08-02
Thanks Andrei. I want to do this for GET requests only and not POST requests. Is this method called only GET requests?
Posted 05 Aug, 2013 05:55:50 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello,

The parameters supplied after the question mark are passed via GET, see for instance the full path of this page: {site/folder/page}?param1=val1¶m2=val2 etc.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Aug, 2013 06:02:15 Top
buy2change




Posts: 3
Joined: 2013-08-02
I went back and tried couple of things.
What is happening is, if I go to http://www.amazon.com, beforenavigate2 method is getting called for each sub resource and my code is getting executed for each one. Is there any way that I can identify, if it is root url (i.e., www.amazon.com) only?

I need to ignore processing all sub-resource urls.

Thanks
Posted 08 Aug, 2013 09:29:36 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hello,

Please try to use the Url property of the ADXIEBeforeNavigate2EventArgs argument to learn what the resource is requested.
Posted 08 Aug, 2013 12:00:15 Top