Saturday, May 30, 2009

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);
}

No comments:

Post a Comment