Westwind.RazorHosting
Westwind.RazorHosting copied to clipboard
Calling RenderPartial inside of a Razor helper results in the contents of the partial view being html encoded
Minimal example below.
MainView.cshtml:
@helper RenderSomething()
{
<div>@RenderPartial("PartialView")</div>
}
<html><body>@RenderSomething()</body></html>
PartialView.cshtml:
<table><tr><td>Hello World</td></tr></table>
Expected output:
<html><body><div><table><tr><td>Hello World</td></tr></table></div></body></html>
Actual output:
<html><body><div><table><tr><td>Hello World</td></tr></table></div></body></html>
The problem appears to be that RazorTemplateBase.WriteTo is not respecting IHtmlString or RawString. I'll submit a pull request with a fix that worked for me.
@RickStrahl Any chance you can take a look at my proposed fix? Any help would be greatly appreciated.