My Account |  Site Map | Contact Us  

Custom Resource Handler with EO.WebBrowser

All Products
EO.Web Controls
EO.Pdf for .NET
EO.Wpf for .NET
EO.WebBrowser for .NET
For Win Forms App
For WPF Apps
Custom Context Menu
.NET -> JavaScript
JavaScript -> .NET
Resource Handler
TabbedBrowser Sample
EO.WebBrowser allows you to intercept or handle any request sent by the browser engine. For example, you can implement a custom resource handler to serve image or the entire HTML from a database. It takes a few easy steps to do so, as described in details here, but the key step is to implement the code that sends out the result. As demonstrated below:
internal class SampleHandler : ResourceHandler
    public const string EmbeddedPageUrl = "sample://embedded_page";

    public override void ProcessRequest(Request request, Response response)
        //Only process EmbeddedPageUrl
        if (string.Compare(request.Url, EmbeddedPageUrl, true) == 0)
            //Set content type
            response.ContentType = "text/html";

            //Copy contents of EmbeddedPage.htm to the output stream
            byte[] buffer = new byte[1024];
            Stream stream = typeof(SampleHandler).Assembly.GetManifestResourceStream(
            while (true)
                int nBytesRead = stream.Read(buffer, 0, buffer.Length);
                if (nBytesRead <= 0)

                response.OutputStream.Write(buffer, 0, nBytesRead);

The TabbedBrowser sample uses the above code to handle special Url "sample://embedded_page" and serves the whole HTML from an embedded resource file "EmbeddedPage.html". You can download and install the

See here for detailed information on how to implement custom resource handler.

Additional Resources

  • Product Documentation

    All features are explained in great details in the product documentation. It also contains complete reference information for each type, property or method;

  • Samples

    The download package contains a wide variety of samples with full C# and Visual Basic.NET source code that demonstrate how to use different feature of the EO.WebBrowser library.

  • Technical Support

    Still have questions? Post in our support forum or contact us and we will answer them quickly. Our turn around time is among the best in the industry.