Fix broken code path in antiforgery
This commit is contained in:
parent
7d1d7bc19c
commit
44834debeb
|
|
@ -57,17 +57,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
|
||||||
// _fieldName containing almost any character.
|
// _fieldName containing almost any character.
|
||||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||||
{
|
{
|
||||||
var builder = writer as IHtmlContentBuilder;
|
var htmlTextWriter = writer as HtmlTextWriter;
|
||||||
if (builder != null)
|
if (htmlTextWriter != null)
|
||||||
{
|
{
|
||||||
// If possible, defer encoding until we're writing to the response.
|
// If possible, defer encoding until we're writing to the response.
|
||||||
// But there's little reason to keep this IHtmlContent instance around.
|
htmlTextWriter.Write(this);
|
||||||
builder
|
return;
|
||||||
.AppendHtml("<input name=\"")
|
|
||||||
.Append(_fieldName)
|
|
||||||
.AppendHtml("\" type=\"hidden\" value=\"")
|
|
||||||
.Append(_requestToken)
|
|
||||||
.AppendHtml("\" />");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.Write("<input name=\"");
|
writer.Write("<input name=\"");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue