Posts From The Archive

Unit Testing HostingEnvironment.MapPath()

Without getting into all the whys and wtfs, the other day I had a need to dynamically render and inject html snippets into various webpages at runtime. The project I’m working on originally created the html in C# by concatenating string fragments and formatting them with runtime values. With all the requisite escape sequences needed to create valid html (including encapsulated JavaScript), this approach struck me as a bit messy and I decided to take a different route. [Read More]