/// <summary>Renders the action and returns a string.</summary> /// <param name="renderer">The delegate to render.</param> internal string Capture(Action renderer) { HttpResponseBase response = _context.Response; Stream originalFilter = null; CaptureFilter filter; string html = ""; if (renderer != null) { try { _context.Session.UpdateSessionId(); response.Flush(); originalFilter = response.Filter; filter = new CaptureFilter(response.Filter); response.Filter = filter; renderer(); response.Flush(); html = filter.GetContents(response.ContentEncoding); } finally { if (originalFilter != null) { response.Filter = originalFilter; } } } return(html); }
/// <summary>Renders the action and returns a string.</summary> /// <param name="renderer">The delegate to render.</param> internal string Capture(Action renderer) { HttpResponseBase response = _context.Response; Stream originalFilter = null; CaptureFilter filter; string html = ""; if (renderer != null) { try { _context.Session.UpdateSessionId(); response.Flush(); originalFilter = response.Filter; filter = new CaptureFilter(response.Filter); response.Filter = filter; renderer(); response.Flush(); html = filter.GetContents(response.ContentEncoding); } finally { if (originalFilter != null) response.Filter = originalFilter; } } return html; }