HTML File Reader with Dynamic Token Replacement

I’ve just published a series of C# classes on the Code site that provide the ability to add dynamic content to static HTML data.


There is an abstract base class called HtmlReader, and two derived classes called HtmlDataReader and HtmlFileReader.

The base class provides functionality for replacing “token names” embedded into Html with their corresponding “token values” at runtime.

The token name/value pairs are passed to the constructor in a HashTable. The “token delimiter” is also passed to the constructor, but has a default value of ‘~’.

HtmlDataReader takes a byte array or string containing HTML data, and uses it as the source for the reader.

HtmlFileReader takes a file path, and internally creates a FileStream to use as the source for the reader.

The HtmlFileReader class was tested on a Panda II using an Http server that I wrote, running over a period of 18 hours, processing 216 Html “file” requests, and it experienced no failures and no memory leaks.

I’ve included examples of how to use the readers, including the Html for two web pages that display dynamically updated network and device status information. The idea for these web pages came from @ Nicolas3’s excellent NetConfig code at

The example code contains references to other classes I’ve written that are part of my FEZConnect driver. Those classes are still under development, and will be released to the TinyCLR Code site soon.

Cool, thanks!

Thanks fro sharing.

Thanks. I’ve read a few threads on this forum where people are looking for this sort of thing, and I needed it myself, so I thought I would give it a try. It’s not written in the most efficient way, especially the parser, but it seems to do the job.

What do you mean by “1500 lines of code, would not fit here” ?

@ Josh
I don’t understand? I didn’t post those words.