資源簡介
原理:ActionFilterAttribute
代碼片段和文件信息
public?class?ReplaceTagsFilter?:?MemoryStream
{
????private?readonly?Stream?_response;
????public?ReplaceTagsFilter(Stream?response)
????{
????????_response?=?response;
????}
????public?override?void?Write(byte[]?buffer?int?offset?int?count)
????{
????????var?html?=?Encoding.UTF8.GetString(buffer);
????????html?=?ReplaceTags(html);
????????buffer?=?Encoding.UTF8.GetBytes(html);
????????_response.Write(buffer?offset?buffer.Length);
????}
????private?string?ReplaceTags(stri
評論
共有 條評論