I have a page with a list where can I download XML Files, but there is a server of a company that below the XML file is the page's HTML together. The XML on download code usually works on all servers where the application is installed except that server. The method for downloading the file is as follows:
public void StreamFileToBrowser(string sFileName, byte[] fileBytes, string ext)
{
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}", ext);
context.Response.AppendHeader("content-disposition", "attachment; filename=" + sFileName);
context.Response.BinaryWrite(fileBytes);
}
Any alternative way to force file download?
EDIT
This method is called when the user click on download button.