Method described here enter link description here dosen't work. The "ResourceHandler" is interface, so the "CanLoadResource" cant be overrided. Update the documentation and provide a correct way to handle resources loading
Asked
Active
Viewed 115 times
1 Answers
0
Thanks for letting us know about a mistake in documentation.
Here is a proper ResourceHandler
implementation:
private class TestResourceHandler : ResourceHandler
{
public bool CanLoadResource(ResourceParams parameters)
{
if (parameters.ResourceType == ResourceType.XHR)
{
Console.WriteLine("Suppress ajax call - " + parameters.URL);
return false;
}
return true;
}
}
A complete sample that demonstrates how to configure the resource handler can be found by the following link: Filter AJAX calls via ResourceHandler

Anna Dolbina
- 1
- 1
- 8
- 9
-
Ann, the problem is that the method "CanLoadResource" never fired – Alexander Samokhin Nov 25 '16 at 12:46
-
Thank you for letting us know about that. It appears that there is a ResourceHandler bug in DotNetBrowser 1.8.3. This bug can be workarounded by setting up a default network delegate: `browser.Context.NetworkService.NetworkDelegate = new DefaultNetworkDelegate();` In addition, I recommend you to contact us via support e-mail. – Anna Dolbina Nov 25 '16 at 13:58
-
The `ResourceHandler` issue is fixed in DotNetBrowser 1.8.4 – Anna Dolbina Feb 03 '17 at 13:51