This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace yourApplicationNameSpace | |
{ | |
public class JavascriptOutputAttribute : ActionFilterAttribute | |
{ | |
private static readonly Regex OpenScriptTag = new Regex(@"^\s*<script[^>]*>", RegexOptions.Compiled); | |
private static readonly Regex CloseScriptTag = new Regex(@"</script>\s*$", RegexOptions.Compiled); | |
public override async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next) | |
{ | |
var resp = context.HttpContext.Response; |