Skip to content

Instantly share code, notes, and snippets.

@martinrayenglish
Created October 31, 2020 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinrayenglish/2acdac5aaf4844d14e3911fc256a936f to your computer and use it in GitHub Desktop.
Save martinrayenglish/2acdac5aaf4844d14e3911fc256a936f to your computer and use it in GitHub Desktop.
public class RemoveNonEditingHtmlElements : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
if (args.HttpContext.Response.HeadersWritten ||
Context.Site == null ||
Context.Site.Name == "shell" ||
Context.Item == null)
{
return;
}
var ctx = args.HttpContext.Response;
if (ctx.Filter == null)
{
return;
}
var filter = ctx.Filter;
var extenderResponseFilter = new RemoveHtmlElementResponseFilter(filter);
extenderResponseFilter.Flush();
ctx.Filter = extenderResponseFilter;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment