I have a list of invoices where I can download XML, but there is a company server below the XML file that comes with the HTML of the page. The XML download code works normally on all servers where the application is installed except on that client. The method to download the file is as follows:
public void StreamFileToBrowser(string sFileName, byte[] fileBytes, string extensao)
{
HttpContext context = HttpContext.Current;
context.Response.Buffer = false;
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.AppendHeader("content-length", fileBytes.Length.ToString());
context.Response.ContentType = "application/octet-stream";//string.Format("application/{0}", extensao);
context.Response.AppendHeader("content-disposition", "attachment; filename=" + sFileName);
context.Response.BinaryWrite(fileBytes);
}
Any workaround to force the file to download?