Downloading file from server (asp.net) to IE8 Content-Disposition problem with file name
- by David
I am downloading a file from the server/database via aspx page. When using the content-disposition inline the document opens in correct application but the file name is the same as the web page. I want the document to open in say MS Word but with the correct file name. Here is the code that I am using
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
Response.ContentType = MimeType(fileName); //function to return the correct MIME TYPE
Response.AddHeader("Content-Disposition", @"inline;filename=" + fileName);
Response.AddHeader("Content-Length", image.Length.ToString());
Response.BinaryWrite(image);
Response.Flush();
Response.Close();
So again, I want the file to open in MS Word with the correct document file name so that the user can properly save/view.
Ideas? thanks