public void Init(HttpApplication context) { context.BeginRequest += (o, e) => { var localPath = context.Request.Url.LocalPath; if (localPath == "/swagger" || localPath == "/swagger/ui/index") { if (Content == null) { Content = RenderViewToString("SwashbuckleMVC", "Index", new Tuple<string, string>("!!!Content!!!", "!!!scripts!!!")); string splitData = "!Here will be content!"; var index = Content.IndexOf(splitData); ContentTop = Content.Substring(0, index); ContentDown = Content.Substring(index + splitData.Length); } context.Response.BufferOutput = true; context.Response.Buffer = true; var id=Guid.NewGuid(); var _watcher = new ResponseFilterStream(context.Response.Filter,id); _watcher.TransformStream += _watcher_TransformStream; context.Response.Filter = _watcher; page.Add(id,0); } }; ////context.EndRequest += (o, e) => //context.PostRequestHandlerExecute += (o, e) => //{ // var localPath = context.Request.Url.LocalPath; // context.Response.Flush(); //}; }
public void Init(HttpApplication context) { context.BeginRequest += (o, e) => { var localPath = context.Request.Url.LocalPath; if (localPath == "/swagger" || localPath == "/swagger/ui/index") { if (Content == null) { Content = RenderViewToString("SwashbuckleMVC", "Index", new Tuple <string, string>("!!!Content!!!", "!!!scripts!!!")); string splitData = "!Here will be content!"; var index = Content.IndexOf(splitData); ContentTop = Content.Substring(0, index); ContentDown = Content.Substring(index + splitData.Length); } context.Response.BufferOutput = true; context.Response.Buffer = true; var id = Guid.NewGuid(); var _watcher = new ResponseFilterStream(context.Response.Filter, id); _watcher.TransformStream += _watcher_TransformStream; context.Response.Filter = _watcher; page.Add(id, 0); } }; ////context.EndRequest += (o, e) => //context.PostRequestHandlerExecute += (o, e) => //{ // var localPath = context.Request.Url.LocalPath; // context.Response.Flush(); //}; }