0

I'm developing an application with an internal web server that displays html static pages in Chromium cefsharp. The pages have some tags within them, and then a buffer processing is made before passing it to the browser.

the code that passes the browser to the html page buffer is as follows:

 if (Path.GetExtension(filename).ToLower() == ".htm" || Path.GetExtension(filename).ToLower() == ".html")
            {
                string responseBuf = template.doTemplating(Encoding.UTF8.GetString(buffer));
                buffer = Encoding.UTF8.GetBytes(responseBuf);
            }
            context.Response.OutputStream.Write(buffer, 0, buffer.Length);

The question is: why a blank page is displayed. Note that the buffer actually contains the entire html page processed.

Miky
  • 1
  • 1
  • Welcome to Stack Overflow! Please provide a [minimal example](https://stackoverflow.com/help/mcve) so that someone here can help you. – vasek Sep 05 '17 at 07:02
  • Not sure if it is the issue here but make sure to flush the stream after you're doing writing, i.e. `context.Response.OutputStream.Flush();`. – nbokmans Sep 05 '17 at 07:54
  • I have alredy put the instruction: context.Response.OutputStream.Flush(); but nothing happens. – Miky Sep 05 '17 at 10:43
  • i think that the problem is in string to byte[] conversion and viceversa. – Miky Sep 05 '17 at 10:50
  • Thanks for your help. – Miky Sep 05 '17 at 10:52

0 Answers0