This is how I normally execute an aspx web form and get a string from the output:
public static string GetAspPageOutput(string page)
{
string html;
using (var sw = new StringWriter())
{
HttpContext.Current.Server.Execute(page, sw);
html = sw.ToString();
}
return html;
}
How do I instead get a byte array?