I am currently loading a html file from a filepath and reading it as text. I then replace certain characters in the file itself and I want to convert it back to html.
This is how I do it currently:
HtmlDocument document = new HtmlDocument();
document.Load(@message.Location);
content = document.DocumentNode.OuterHtml;
//Code to replace text
var eContent = HttpUtility.HtmlEncode(content);
When I debug and check what eContent holds, I can see newline characters like "\r\n". If I copy and paste the text into a .html file, only the text appears, not a proper html page.
I'm using Html AgilityPack already and am unsure of what else I need to do.
EDIT:
I have also tried
var result = new HtmlString(content);