public static RenderingContext CaptureIn(this HtmlHelper html, string context)
 {
     var page = html.ViewDataContainer as WebPageBase;
     if (page == null)
     {
         throw new InvalidOperationException("We currently cannot support views not deriving from WebPageBase.");
     }
     return new RenderingContext(page.OutputStack, html.Captures().GetOrAdd(context, s => new Stack<string>()));
 }
 public static HtmlString RenderCapture(this HtmlHelper html, string context)
 {
     var output = html.Captures().GetOrAdd(context, s => new Stack<string>());
     var sb = new StringBuilder();
     foreach (var str in output)
     {
         sb.Append(str);
     }
     return new HtmlString(sb.ToString());
 }