This project is read-only.

RenderAsHtml() does not use input HttpContextBase

Jan 31, 2012 at 11:23 PM

When I look at the code for RenderAsHtml() when you pass in an HttpContext it is calling the Render method with a null HttpContext.  Is there a reason for this or is it just a bug?

ILSpy output

// RazorGenerator.Testing.WebViewPageExtensions
public static HtmlDocument RenderAsHtml<TModel>(this WebViewPage<TModel> view, HttpContextBase httpContext, TModel model = null)
    string html = view.Render(model);
    HtmlDocument htmlDocument = new HtmlDocument();
    return htmlDocument;

Shouldn't the first line be

string html = view.Render(httpContext, model);

Feb 1, 2012 at 12:18 AM

You may be running an old build. See here for what the current code looks like.