I’m trying to show test run log (text file in a windows server) to the user if he/she clicks a link.
So far I’m able to return the string but the formatting is lost (no newlines) when displayed in the browser.
public string GetTestLog(...)
{
return File.ReadAllText(logFileUrl);
}
How can I keep the formatting of the string?
You could return the file with test/plain contentType and then it should render properly as a text file…
If you are rendering it as HTML, you have to replace all newlines with
<br/>or enclose it in aTEXTAREAorPRE.