I have a huge problem in all browsers.
I have a website where clients can upload a csv file containing the details they need.
The problem I encountered is that the csv file is either downloaded without the extension, or as an htm file.
In the code I specify the file name with .csv, the file on the server is also .csv.
The code is as follows
context.Response.Buffer = true;
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ContentType = "text/csv";
context.Response.AppendHeader("Content-Disposition", @"attachment,
filename=" + ((string)Path.GetFileName(downloadFilePath)));
context.Response.WriteFile(downloadFilePath);
context.Response.Flush();
context.Response.Close();
I tried context.Response.ContentType = "text/html";and context.Response.ContentType = "application/octet-stream";.
Powered by IIS6.
Does anyone know what could be causing this?
source
share