I'm generating a CSV-file on the fly in ASP .Net C#, and writing it directly to the response.
private void ExportToResponse(string textCsv, string fileName)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "text/csv";
HttpContext.Current.Response.ContentEncoding = Encoding.Unicode;
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ".csv");
HttpContext.Current.Response.Write(textCsv);
HttpContext.Current.Response.End();
}
And in most cases this works well, but in some cases I get an error ("this website can not be displayed in Internet Explorer"). I suspect that the reason is that this file is getting to large for the response. In that case, how to I extend the limit of the response length?
I was hoping I could do this in the web.config-file, similar to how you set the mexRequestLength-property to the httpRuntime-element (http://msdn.microsoft.com/en-us/library/e1f13641.aspx).
Thanks!