Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling RenderPartial inside of a Razor helper results in the contents of the partial view being html encoded #35

Open
mikdav opened this issue May 30, 2019 · 1 comment

Comments

@mikdav
Copy link

mikdav commented May 30, 2019

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>&lt;table&gt;&lt;tr&gt;&lt;td&gt;Hello World&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</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.

@mikdav
Copy link
Author

mikdav commented Jun 14, 2019

@RickStrahl
Any chance you can take a look at my proposed fix? Any help would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant