OnRequest callback and Request Blocking/Redirection ?

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

OnRequest callback and Request Blocking/Redirection ?
Can you block or redirect requests in this callback or is there any way to do it ? 
George Kierstein




Posts: 47
Joined: 2013-05-04
Hi,

I'm building a blocking add-in and am wondering how you use the Framework to actually block or re-redirect URL requests. I am seeing all the requests made on a page properly but the callback doesn't have a return code and seems passive.

Additionally I am struggling with the Documentation provided for Visual Studio 2010 when it comes to what the event argument does and how to use it.

Is there a way to block and redirect URLs that pass through OnRequest ?
Posted 13 May, 2013 16:39:18 Top
George Kierstein




Posts: 47
Joined: 2013-05-04
Any thoughts on how to approach this ?

Best
G
Posted 14 May, 2013 22:10:12 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi George,

No, the OnRequest event doesn't provide such a functionality. You need to use the BeforeNavigate2 event to block and redirect the current navigation.

>>Additionally I am struggling with the Documentation provided for Visual Studio 2010 when it comes to what
>>the event argument does and how to use it.
The description of which exactly properties causes difficulties?
Posted 15 May, 2013 09:17:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Here is the sample code that redirects urls that start with the 'http://www.google'.

private void IEModule_BeforeNavigate2(ADXIEBeforeNavigate2EventArgs e)
{
string url = (string)e.Url;

if ((!String.IsNullOrEmpty(url)) && url.StartsWith("http://www.google."))
{
e.Cancel = true;
this.IEApp.Stop();

object dummy = null;
IEApp.Navigate("http://www.anyurl.com", ref dummy, ref dummy, ref dummy, ref dummy);
}
}
Posted 15 May, 2013 09:45:45 Top