Outputting SVG code from Media Picker for customization

I found this page on customizing SVGs and it’s exactly what I need, but I’m unable to use “HostingEnvironment” in the following code:

var helperSvg = helperIconUrl != "" ? 
 System.IO.File.ReadAllText(HostingEnvironment.WebRootPath + helperIconUrl) : "";

because it says it’s “inaccessible due to its protection level”. Is there a way to get around this or fix it? Or is there an alternative code I could use to accomplish the same thing?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/113284-outputting-svg-code-from-media-picker-for-customization