0
I have a list of tax notes where I can download XML, but there is a server of a company that below the XML file comes with the HTML of the page. The XML download code works normally on all servers where the application is installed except for this client. The file download method 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);
}
Some alternative solution to force file download?
I will try to publish a version on the client server using the code you showed me, but it is calling all these functions precisely because of our attempts to solve the problem. Maybe it was like yours in the beginning. I picked up this code after others tried to solve it.
– Salatiel
It didn’t work that way. Some other idea?
– Salatiel