---
title: "Setting ContentType = “image/tiff” and sending an image is not working in IE"  
description: "Setting ContentType = “image/tiff” and sending an image is not working in IE"  
author: "Mark Devid"  
published: 2014-08-26  
updated: 2014-08-26  
canonical: https://www.mindstick.com/forum/2153/setting-contenttype-image-tiff-and-sending-an-image-is-not-working-in-ie  
category: "asp.net"  
tags: ["asp.net", ".net", "c#", "Setting ContentType", "image/tiff", "open source", "free"]  
reading_time: 2 minutes  

---

# Setting ContentType = “image/tiff” and sending an image is not working in IE

I need to send an image (as a downloadable file) from an ASP [web page](https://www.mindstick.com/forum/718/sql-server-report-alignment-to-center-of-web-page). It is working correctly in every browser except for IE (all [versions](https://answers.mindstick.com/qa/49863/list-the-versions-of-mac-os-x)).

Here is the [server side](https://www.mindstick.com/forum/318/how-to-call-javascript-fuction-in-server-side) code:

bool export = Request.QueryString["Export"] != null;

if (export)

{

byte[] allBytes = File.ReadAllBytes(@"C:\MyImage.tif");

Response.ContentType = "image/tiff";

Response.AddHeader("content-disposition", "attachment; [filename](https://www.mindstick.com/interview/23463/difference-between-include-filename-and-include-filename)=\"MyImage.tif\"");

Response.OutputStream.Write(allBytes, 0, allBytes.Length);

Response.OutputStream.Flush();

Response.End();

return;

}

And here is the [JavaScript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript):

$('#ExportFrame').attr('src', 'Default.aspx?Export=true'); // ExportFrame is an iframe

In IE, I keep [getting an error](https://answers.mindstick.com/qa/95244/why-do-you-keep-getting-an-error-message-ox800ccc0b) saying "[Internet](https://www.mindstick.com/articles/44650/what-should-you-do-during-an-internet-outage) [Explorer](https://www.mindstick.com/forum/34658/want-to-developed-windows-explorer-without-using-telerik) cannot [download](https://www.mindstick.com/articles/188403/website-to-download-photos-from-instagram) Default.aspx from localhost". I thought it might be an issue with loading it in an iframe element, but redirecting to the URL is not working either. The really odd thing is that going to the URL (/Default.aspx?Export=true) does not work the first time, but works every time after that. Again, this works in every browser I've tried except IE.

Any ideas?

## Replies

### Reply by Sumit Kesarwani

Hi Mark,

The aspx page had the following code to keep the page from getting cached:

```
// Never cache this pageResponse.CacheControl = "no-cache";Response.AddHeader("Pragma", "no-cache");Response.Expires = -1;
```

Removing the first 2 lines and leaving only Response.Expires = -1 resolved the issue. For some reason this was preventing the image from working properly in IE. \


---

Original Source: https://www.mindstick.com/forum/2153/setting-contenttype-image-tiff-and-sending-an-image-is-not-working-in-ie

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
