Over a million developers have joined DZone.

Write File To Response Stream

·
// Wrtites temporary file to response stream and then delete

Response.Clear();
Response.ContentType = "image/tiff";
Response.AddHeader("Content-Disposition", "attachment; filename=imageFile.tiff");
Response.WriteFile(tempPath);
Response.Flush();
Response.Close();
if(File.Exists(tempPath)){
    File.Delete(tempPath);
}
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}