According to this article if we use several tag helpers(targeted to the same tag) and in each of them we will use await output.GetChildContentAsync()
to recieve html content we will come to the problem with cached output:
The problem is that the tag helper output is cached, and when the WWW tag helper is run, it overwrites the cached output from the HTTP tag helper.
The problem is fixed by using statement like:
var childContent = output.Content.IsModified ? output.Content.GetContent() :
(await output.GetChildContentAsync()).GetContent();
Description of this behaviour:
The code above checks to see if the content has been modified, and if it has, it gets the content from the output buffer.
The questions are:
1) What is the difference beetween TagHelperOutput.GetChildContentAsync()
and TagHelperOutput.Content.GetContent()
under the hood?
2) Which method writes result to buffer?
3) What does it mean "cached output": ASP.NET MVC Core caches initial razor markup or html markup as result of TagHelper
calling?
Thank in advance!